WICG / file-system-access

Expose the file system on the user’s device, so Web apps can interoperate with the user’s native applications.
https://wicg.github.io/file-system-access/
Other
669 stars 66 forks source link

Support files with unknown file size #241

Closed raymeskhoury closed 1 year ago

raymeskhoury commented 4 years ago

Some filesystems (e.g. those exposed using the Android DocumentsProvider API) allow files that have an unknown size. One use case here is when a file is generated when accessed. For example, an online drawing app has an internal representation of the user's images. It can expose a virtual filesystem of .png files for each drawing. However these png's will actually be generated at the time the file is accessed and so the size isn't known ahead of time (e.g. when listing the files).

The current file APIs require a size ahead of time and don't provide a constant to specify an unknown size. This would be something nice to add.

@mkruisselbrink

mgiuca commented 3 years ago

I think this is a dupe of #101 -- but highlighting the core requirement of the proposed getMetadata API that it needs to allow the implementation to return null fields (in this case, return a null file size) so that we can return as much metadata as possible without fetching the entire file, which in the DocumentsProvider case, is the only way to get the file size.

a-sully commented 1 year ago

101 has since been ported to https://github.com/whatwg/fs/issues/12. Your point is noted - we'll keep this use case in mind on that issue