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

command/pipe: add more examples #643

Merged
merged 4 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ $ tree
Will upload all files at given directory to S3 while keeping the folder hierarchy
of the source.

#### Stream stdin to S3
You can upload remote objects by piping stdin to `s5cmd`:

curl https://github.com/peak/s5cmd/ | s5cmd pipe s3://bucket/s5cmd.html

Or you can compress the data before uploading:

tar -cf - file.bin | s5cmd pipe s3://bucket/file.bin.tar

#### Delete an S3 object

s5cmd rm s3://bucket/logs/2020/03/18/file1.gz
Expand Down
4 changes: 4 additions & 0 deletions command/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Options:
Examples:
01. Stream stdin to an object
> echo "content" | gzip | s5cmd {{.HelpName}} s3://bucket/prefix/object.gz
02. Download an object and stream it to a bucket
> curl https://github.com/peak/s5cmd/ | s5cmd {{.HelpName}} s3://bucket/s5cmd.html
03. Compress an object and stream it to a bucket
> tar -cf - file.bin | s5cmd {{.HelpName}} s3://bucket/file.bin.tar
`

func NewPipeCommandFlags() []cli.Flag {
Expand Down