Generate data for large random file

Hi,

I want to be able to feed random data to S3 to create a large multipart uploaded object. I don’t have, or at least may not have, enough disk space to create the file in the local filesystem so I’d like to be able to do something like setup a way to read, e.g. from /dev/urandom, or generate random data X bytes at a time until I reach the desired file size.

Any suggestions?

Thanks,

Rob

The crypto/rand package has a Reader for this purpose: https://golang.org/pkg/crypto/rand/#pkg-variables

Combine that with a LimitedReader and it can be you upload body.

Thank-you. I’ll take a look at it. It appears that rand reads from /dev/urandom, so it should give me something similar to what I’m doing with Python.

Rob

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.