From dd19e8ffb63d58aaa97bf2be2203abfec8d44682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Hakan=20Be=C5=9Fel?= Date: Mon, 21 Aug 2023 10:06:01 +0300 Subject: [PATCH 1/3] command/pipe: add more examples --- README.md | 9 +++++++++ command/pipe.go | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index af9165b6f..e60a2cb9b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/command/pipe.go b/command/pipe.go index 6e45ae052..8384e5dfc 100644 --- a/command/pipe.go +++ b/command/pipe.go @@ -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 { From 765b0e98f71119a838f6910a9ac02cd7f6a83dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0brahim=20G=C3=BCng=C3=B6r?= Date: Mon, 21 Aug 2023 15:14:54 +0300 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e60a2cb9b..a76db99d1 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ 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 + curl https://github.com/peak/s5cmd/ | s5cmd pipe s3://bucket/s5cmd.html Or you can compress the data before uploading: From 7317d69c6e1e9d84c82c165a2010434b1b4800db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0brahim=20G=C3=BCng=C3=B6r?= Date: Mon, 21 Aug 2023 15:14:59 +0300 Subject: [PATCH 3/3] Update command/pipe.go --- command/pipe.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/pipe.go b/command/pipe.go index 8384e5dfc..77370a18e 100644 --- a/command/pipe.go +++ b/command/pipe.go @@ -29,7 +29,7 @@ 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 + > 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 `