Open alexgleason opened 1 year ago
I looked into this briefly and it seems that Node doesn't have a way to seek from the current position or end of the file. It seems some people do it by adding native bindings (ex. https://github.com/baudehlo/node-fs-ext/blob/3125353321c30bd35fc38e40ce76ffe3872e215b/fs-ext.js#L113).
I tried to at least have seek from the start of the file, but it didn't seem to work: https://github.com/dsherret/node_deno_shims/tree/seek
Currently null is being passed to read, so it uses the current file offset.
In the absence of a way to seek, I think the only way to do this would be to internally track the position instead of passing null.
https://nodejs.org/api/fs.html#fsreadfd-buffer-offset-length-position-callback
Would need to setup some mapping between FD and position.
Create a PR to implement seek functions in the only way I think is really possible.
When trying to transpile with shims, I get the following error: