[whatwg] getAsEntry(File) was, Re: Using requestFileSystem to setup mounts
chuck at jumis.com
Wed Dec 14 12:32:56 PST 2011
On 12/14/2011 12:18 PM, Eric Uhrhane wrote:
>> > I'd like to see a means of getting an "anonymous" FileEntry.
>> > http://www.w3.org/TR/file-system-api/
>> > The purpose being to convert a File object into a read-only FileEntry object
>> > (with an anonymous FileSystem object).
>> > Currently, a FileEntry can be converted into a File object, but to turn a
>> > File object into a FileEntry requires a writable FileSystem as well as a few
>> > calls to file writer methods.
>> > It may be easier to use copyTo instead of FileWriter in some cases, and it
>> > may be easier to treat dataTransfer items as FileEntry objects depending on
>> > the application and code paths.
> True; this could be a nice convenience feature, as long as it could be
> made read-only and all path information could be scrubbed.
The FileEntry should certainly be read only, and it would -only- have a
path if webkitRelativePath exposed one.
I was a little "iffy" about whether or not the root FileSystem should be
completely read only, or whether it should allow files to run copyTo
commands and directory creation. I don't think that use case needs to be
explored from the onset: one might copy a few files into the FileSystem,
then send that file system to another site via postMessage or to a web
worker for zip packaging. To send a nice structured directory, one would
need to be able to create directories and execute copyTo commands into them.
Any kind of delete or remove would not alter the underlying file, as
it's simply an anonymous entry. There would be no room for altering the
files themselves -- authors would need to use BlobBuilder for that.
I'm glad you're ok with this is a convenience feature. I think it's in
spec, I don't consider it scope creep.
If you want to discuss this idea of allowing users to create directories
on the anonymous FileSystem, I'm up for that discussion, but I don't
think it's necessary for a first round of simply allowing a getAsEntry
More information about the whatwg