-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
want: add file.readAt() and file.writeAt() #3508
Comments
Am in need of this for implementing pread/pwrite in https://deno.land/x/wasi. Adding an optional offset is the way to go IMHO. |
This issue has been open for a while - I'll work on it. |
I'm jumping on this one. |
Is anyone actively working on this? |
Hey, I'm not. I assumed the person who posted after me was taking it. It doesn't look like anyone is working on it |
@caspervonb @fvkramer i have something started but i'm also having a kid like with in 2 weeks.... so if you get this done just toss it out there. |
Any updates? I'm really looking forward to it. |
You can already do this with |
It's a worth-while optimisation but I won't be getting around to it for a while. WASI does that and the performance hit is not that terrible. |
The goal of built-ins is to have a reasonable set of APIs on which further capabilities can be abstracted on; this feature seems to me more like something that could be done in std, and don't see the necessity to implement this for performance benefits. Especially with the various improvements to the op layer, performance concerns shouldn't be as bad anymore as when this issue was being discussed, so closing. |
Offset operations can currently be performed with
seek
, but some concise APIs are missingThese APIs are more semantic and easier to understand
Golang
also provides a similar APIfile.readAt(bytes: Uint8Array, offset: number)
mock api
file.writeAt(bytes: Uint8Array, offset: number)
same as above
Why
Should have the API to quickly read/write some data from file
Or maybe extend the
Deno.read(b: Uint8Array)
API toDeno.read(b: Uint8Array, offset?: number)
will be better?The text was updated successfully, but these errors were encountered: