Re: Moving File API: Directories and System API to Note track?

On Sep 21, 2012, at 10:10 PM, Jonas Sicking <jonas@sicking.cc> wrote:

> 
> For what it's worth, I put together a draft for what an API would look
> like that has basically the same feature set as the current FileSystem
> API, but based on DeviceStorage. It's a much smaller API that the
> current FileSystem drafts, but supports things like shallow as well as
> deep directory iteration.
> 
> https://wiki.mozilla.org/WebAPI/DeviceStorageAPI2
> 
> I think that if we at mozilla were to implement a sandboxed
> filesystem, it'd be something more like this.

I took a crack at a pruned and cleaned up version:

https://trac.webkit.org/wiki/MinimalFileStorage

Only 4 interfaces (excluding the Navigator addition), 16 methods, 9 attributes. And two of the interfaces are generic and reusable in other contexts.

It removes cruft but adds features relative to the Mozilla version:

- Atomic create/open operation
- Renaming files and directories
- A Directory interface for less weirdness in directory handling
- Ability to open files in append mode (this makes more sense than an append() operation on the handle, given the way underlying filesystems work)

Features omitted include:
 - Multiple named filesystems (just use directories)
- Separate enumeration for writing (just use open)
- Ability to fetch matadata (does not appear to be needed for the use case)


It could be simplified a little bit, but really not that much, by removing hierarchy.

Regards,
Maciej 

Received on Sunday, 23 September 2012 01:06:38 UTC