Copy files between buckets

101 views
Skip to first unread message

Herbert Fischer

unread,
May 22, 2013, 5:09:57 PM5/22/13
to go...@googlegroups.com
Hi, goamz newbie here...

First of all thank you for this library! Without it I couldn't use Go (and be happier) to solve a problem here... :)

With goamz I'm coding something that need to copy of files between buckets. 

So I have these two questions...

1) Is it safe to directly connect the io.ReadCloser from Bucket.GetReader to the Bucket.PutReader()?

something like this:

// Given size and mime type information I have stored somewhere else
var objectSize int64
var mimeType string 

var src, dst *s3.Bucket
// hidden: src and dst init ...

rc, err := src.GetReader(sourcePath)
// hidden: err checking ...

err = dst.PutReader(destPath, rc, objectSize, mimeType, s3.Private)
// hidden: err checking ..

2) Using goamz, how can I get the metadata information for a given S3 object's path (size, mime type, ACL)?

thank you in advance!

Herbert

Herbert Fischer

unread,
May 23, 2013, 1:35:12 PM5/23/13
to go...@googlegroups.com
(thumbleweed) :(



Herbert

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

Gustavo Niemeyer

unread,
May 23, 2013, 1:49:58 PM5/23/13
to go...@googlegroups.com
Hey Herbert,

On Wed, May 22, 2013 at 6:09 PM, Herbert Fischer
<herbert...@gmail.com> wrote:
> With goamz I'm coding something that need to copy of files between buckets.

The ideal way to copy files in S3 is to use the API itself, but that's
not yet supported by goamz.

> So I have these two questions...
>
> 1) Is it safe to directly connect the io.ReadCloser from Bucket.GetReader to
> the Bucket.PutReader()?

It is, yeah.

> 2) Using goamz, how can I get the metadata information for a given S3
> object's path (size, mime type, ACL)?

The API of goamz is weak in that regard. I have a new design to put in
place that will sort this and a number of related issues, but I
haven't had the time to put those ideas in place yet.


gustavo @ http://niemeyer.net

Herbert Fischer

unread,
May 23, 2013, 1:57:32 PM5/23/13
to go...@googlegroups.com
Thank you Gustavo,

1) Great! I was just a bit puzzled/worried about all the magic involved in dealing with possible network or S3/API errors behind this.

2) Currently I think goamz is good enough for me. Luckily I have my own metadata store that enables me to do the magic in (1). 

Maybe I can help you to put those ideas in place, If you want. ;)

[]s,

Herbert


Reply all
Reply to author
Forward
0 new messages