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

makes 'ipfs files write' usage docs clearer #2403

Merged
merged 1 commit into from
Mar 1, 2016

Conversation

hackergrrl
Copy link
Contributor

addresses #2380 and #2380 (comment)

A couple of notes on --truncate and --offset.

License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
@hackergrrl hackergrrl changed the title addresses https://github.com/ipfs/go-ipfs/issues/2380 and https://github.com/ipfs/go-ipfs/issues/2380#issuecomment-188443493 makes 'ipfs files write' usage docs clearer Feb 24, 2016
@RichardLitt
Copy link
Member

Doesn't truncate start where offset starts if offset is there, though?

@hackergrrl
Copy link
Contributor Author

@RichardLitt no, it wipes the whole file first:

stephen // ~ $ ipfs files read /myfs/file
!!!?
hello world
stephen // ~ $ echo '&' | ipfs files write /myfs/file --offset 4 --truncate
stephen // ~ $ ipfs files read /myfs/file
&

cc @whyrusleeping -- is this consistent with what's intended?

@whyrusleeping
Copy link
Member

ipfs files write /myfs/file --offset 4 --truncate equates to opening a file with O_TRUNC and calling seek() to set the position of the file descriptor to 4. Doing so will sparsely expand the file (with zeros) up to the point where you start writing.

@whyrusleeping
Copy link
Member

these doc changes LGTM

whyrusleeping added a commit that referenced this pull request Mar 1, 2016
makes 'ipfs files write' usage docs clearer
@whyrusleeping whyrusleeping merged commit cdddf0f into ipfs:master Mar 1, 2016
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

Successfully merging this pull request may close these issues.

3 participants