Skip to content

Commit

Permalink
command/pipe: add more examples (#643)
Browse files Browse the repository at this point in the history
Co-authored-by: İbrahim Güngör <igungor@gmail.com>
  • Loading branch information
ahmethakanbesel and igungor committed Aug 21, 2023
1 parent f58add9 commit b7babaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
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
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

0 comments on commit b7babaf

Please sign in to comment.