Sorry for the long delay in answering your mail. Uploading a file
slice by slice is theoretically possible, but as I discovered while
trying to create a sample answer to your request, does not currently
work.
Normally, all you need to do is to call the Blob.slice method (as File
inherits from blob) to split your file in as many chunks as requested.
However the specification seems to have changed recently (there is a
new draft dated 29 February 2012), redefining the semantic of the
slice method. The new semantic does not seem to be implemented yet
(not in FF11 and Chrome18 at least). The old implementations still
exist, but under a new name (mozSlice, webkitSlice, ... see:
http://dev.w3.org/2006/webapi/FileAPI/#slide-method-algo). The
difference lies in the way a slice is defined: by (start-offset,
length) in the old way, by (start-offset, end-offset) in the new way.
What I am currently contemplating is to fix the current 0.3 release
into a 0.3.1 release. In this upgrade release, I would:
+ Update the documentation of the slice methods (there is a new
overload for the method too). We will need to wait for a few more
browser iterations for the browser vendors to implement the new spec.
+ Create a new set of methods (called slice_) which will let you call
the old implementations, so you can code something today.
+ Mark the slice_ method deprecated to note the fact that they are not
part of the spec any more and will be someday removed from browsers.
I need to read the new spec with a fine tooth comb to see if other
significant changes are required. I will post as soon as I know more
or have something available
Regards
Lukas
I am in the process of transitioning all my projects to github,
including lib-gwt-file. I have uploaded the latest snapshot
(lib-gwt-file-0.3.1-SNAPSHOT) to the corresponding github repository:
https://github.com/laaglu/lib-gwt-file
I have looked at the documentation in MDN and done some tests with the
latest firefox (11) and chromium (19). Currently both browers have
removed the old slice method. They have already implemented the new
slice methods, under the name mozSlice and webkitSlice. Mozilla plans to
unprefix the new method in FF13, I do not know the plans for Chromium to
unprefix their slice methods.
So from my point of view, the only way to make slice work today is to
use the prefixed methods. This is what I have done in the snapshot (you
can see the details of the modifications here:
https://github.com/laaglu/lib-gwt-file/commit/41db1772fcb9f0e7af97e3b3ada1ed54c756604d)
I have done a few tests in which I sliced SVG files and later
reconstructed them and it seemed to work.
I plan to do some more tests, possibly upload my sample to demonstrate
the use of slice, and then finalize lib-gwt-file-0.3.1. Depending on the
progress of my global github migration, this might happen before the end
of the week, but I cannot make any firm commitments.
Regards
Lukas
Thanks for the feedback. I have updated my sample application tonight
(https://github.com/laaglu/lib-gwt-file-test/commit/0588f39cb624e755004132d359ac84b577ca9c4e).
It can now open text files and I slice the file to display only the
first 1000 characters. It seems to work in FF11 and Chromium19. Can
you give more details on the scenario which does not work for you in
FF9 ?
Regards
Lukas
--
You received this message because you are subscribed to the Google Groups "lib-gwt-file" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lib-gwt-file...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.