Fwd: Files on IndexedDB

> The File API spec does allow browsers to store File by reference.
I thought so... that's the reason I was surprised when readed about
implementors where doing otherwise and in fact didn't found anything
about it on the spec.

> Note that there's one limitation to keep in mind.  File is meant to
> represent a snapshot of the file at the time the user gave them to the site,
> rather than the latest copy.  That is, if you store a File object in
> something like IDB, and the user changes the file, the next time the site is
> loaded it should either see a copy of the file as it was before, or get an
> error, not see the user's changes.  This is meant as a security measure; the
> idea is that a user giving a file to a site may not expect that he's giving
> access to that file, and all future changes, for all time, and that
> expecting users to manually revoke access to files somehow isn't reasonable.
> This is represented by the "snapshot state" concept.
> http://dev.w3.org/2006/webapi/FileAPI/#snapshot-state-section
In fact, this can be seen both ways, just a snapshoot or a live
update... From my point of view, if an app want just a file particular
version (a snapshoot, by instance), it would directly copy and/or
upload it, and if it wants to get the updated version, it would get
the reference and being aware of this particular case.

> The difficulty is that most filesystems don't support lightweight snapshots
> of files.  Making a deep copy is one way to implement this, but painfully
> inefficient for large files.  Storing the file's modification time with the
> snapshot, and using it to determine if the file has been changed, should be
> a close enough approximation to address the security concerns.  The spec
> allows this (it leaves the specifics of the "state of the underlying
> storage" as an implementation detail).
> I don't know if there are other IndexedDB-specific issues (not familiar with
> that API).
I don't remember to read about them, or at least my interpretation
give me to think there was no problems and Files and Blob objects
would be added as references. In fact, I remember to read some months
ago that Firefox was storing Files and Blobs directly on hard disk
files on a hidden folder, only that now I'm not sure if user specified
files are being directly specified (that I believe it's the good way
to do it) or are being previously being copied inside this hidden
folder (storing a particular copy, but also wasting a lot of hard disk
space, and also don't allowing to have references inside IndexedDB for
"live files", that's what I'm interested for).

"Si quieres viajar alrededor del mundo y ser invitado a hablar en un
monton de sitios diferentes, simplemente escribe un sistema operativo
 Linus Tordvals, creador del sistema operativo Linux

Received on Sunday, 2 June 2013 22:03:06 UTC