Hello all.

Im new using AWS SDK in go and Im need download file object from S3 to 
Stdout and not create a file.
For example:
my_download_s3_program > file.txt
or
my_download_s3_program | tar
etc

So, I can download to file, but I need stream on the fly to stdout, it's 
possible?

This example write a file:
----------------------------------------------------------------------
            file, err := os.Create("download_file.txt")
            if err != nil {
                fmt.Println("Failed to create file", err)
                os.Exit(4)
            }
            defer file.Close()

            key := path.Join(prefix, filename)

            downloader := 
s3manager.NewDownloader(session.New(&aws.Config{Region: 
aws.String("us-west-2")}))
            numBytes, err := downloader.Download(f,
                &s3.GetObjectInput{
                    Bucket: aws.String(bucket),
                    Key:    aws.String(key),
                })
            if err != nil {
                fmt.Println("Failed to download file", err)
                os.Exit(5)
            }

            fmt.Println("Downloaded file", file.Name(), numBytes, "bytes")

----------------------------------------------------------------------

How can modify this example to stream to stdout?

Well, thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to