Skip to content
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

about 3rd param for uv.fs_write #86

Closed
zhaozg opened this issue Nov 5, 2014 · 2 comments
Closed

about 3rd param for uv.fs_write #86

zhaozg opened this issue Nov 5, 2014 · 2 comments

Comments

@zhaozg
Copy link
Member

zhaozg commented Nov 5, 2014

Think about this

uv.fs_write(dev,chunk,0)
uv.fs_write(dev,chunk,0,cb)

3rd param meas offset in string, If it is optional val, will make code clear.
after have this feature, just change to

uv.fs_write(dev,chunk)
uv.fs_write(dev,chunk,cb)

@creationix
Copy link
Member

luv is meant to be fairly low-level and not have much sugar like optional parameters. The wrapping in luvit does make it optional. https://github.com/luvit/luvit/blob/c274290954c5b23eccdac3fcabaf575dc2f2c633/app/modules/fs.lua#L142-L160

Also according to the man page for pwritev(2) (which is all the libuv docs for uv_fs_write mention), offset is the offset in the file being written to, not an offset in the source buffer.

The pwritev() system call combines the functionality of writev() and pwrite(2). It performs the same task as writev(), but adds a fourth argument, offset, which specifies the file offset at which the output operation is to be performed.

@zhaozg
Copy link
Member Author

zhaozg commented Nov 6, 2014

Got it, thinks

@zhaozg zhaozg closed this as completed Nov 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants