os-js / osjs-client

OS.js Client Module
https://manual.os-js.org/
Other
31 stars 31 forks source link

Support random access api in VFS #158

Open oeway opened 3 years ago

oeway commented 3 years ago

Currently, the VFS has api such as readfile and writefile assumes that one would read and write files as a whole. However, that cannot work for really large files, it would be nice to support byte offset parameters which will then be translated into HTTP range request for remote file systems.

E.g. we can add position and length similar to the fs module in nodejs: https://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback

I would assume that it's easy to implement that for readfile, how about write file, can we also support appending content to a specific position of a file?

andersevenrud commented 3 years ago

It should be sufficient to send the standard HTTP range headers to the readfile endpoint.

On the server-end of things we're working with streams, and ranges is supported.