-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement seekable streams #418
Comments
@lukewagner have you thought at all about how seeking would work for |
In general, I've been assuming that seeking happens via methods on resources that return new streams, e.g.: resource file {
pread-stream: func(offset: u64) -> stream<u8>;
} which reflects the fact that not all stream sources are seekable. However, one operation that does make sense on a stream (and almost made it into wasi-io/streams, iirc) which I think makes sense as a canon built-in would be a |
(For what it's worth, wasi-io/streams does have |
Oops, right, I just missed it in my scan :P |
For wasi-io/streams |
Would the |
Yes. I think that sounds good. I wasn't aware that we already had what I was basically looking for with descriptors. |
Seekable streams would enable a great deal of functionality for my C2PA SDK work and likely many other use cases. I don't have much of an understanding of how this would be implemented, but I'd like to start a conversation.
The most obvious use case would be file handles. This would allow feature parity with web_sys::FileSystemFileHandle.
For example this JS code uses this wasm-bindgen rust code:
The wasm-bindgen rust code can use FIleSystemFileHandle as a stream using createWritable
Besides file handles, seekable streams would be very useful for other use cases. C2PA manifests must be located in very large asset containers, which must be parsed to understand their structure. This requires the streams to be seekable. As a workaround, my POC of a C2PA component reads the input stream into a cursor before passing it to the c2pa SDK functions. This is obviously far from ideal and will not work with very large containers streams such as video.
The text was updated successfully, but these errors were encountered: