:wave: does wasmtime-wasi's WasiCtxBuilder have an equivalent API to wasi-common's File for use with WasiCtxBuilder's stdin method?
I noticed stdout and stderr both support OutputFile but there does not appear to be an equivalent struct for a file for use with stdin. I did find FileInputStream but outside crates don't have access to the &File type which is one of the parameters for its public new function (that seems like the new function shouldn't be public or the File type it requires should be public) and FileInputStream doesn't implement StdinStream which is what WasiCtxBuilder needs for the stdin method.
theres no InputFile corresponding to OutputFile, but as best i can tell, thats just an oversight. you can make a PR to add one if youd like
like OutputFile, the inner should be an Arc<std::fs::File>
the deal with the stdio streams is that there can be multiple resources pointing to stdout, but all of those instances should be pointing to the same underlying state. same for stdin
you should also be able to define and implement InputFile in any library, but since its an oversight that its not provided in wasmtime-wasi we can provide it there as well
Makes sense to me! Any thoughts on what to do with the new method on FileInputStream since it seems to me like that either shouldn't be public or that the File type it expects should be public?
thats also a bug: that should be pub(crate) instead of pub
or, actually, FileInputStream should itself only be pub(crate). its an implementation detail and shouldnt be part of the crates api.
Yeah that makes sense to me too
Last updated: Dec 06 2025 at 06:05 UTC