Skip to content

Instantly share code, notes, and snippets.

@rosskukulinski
Created December 16, 2014 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosskukulinski/d2f754caa9eaef459037 to your computer and use it in GitHub Desktop.
Save rosskukulinski/d2f754caa9eaef459037 to your computer and use it in GitHub Desktop.
pkgcloud s3 upload ex
var cloudstorageclient = pkgcloud.storage.createClient({
provider: "amazon",
accessKeyId: "**redacted**",
accessKey: "**redacted**",
region:"us-west-2"
});
var localuploadfile = fs.createReadStream('/path/to/local/file');
var cloudupload = cloudstorageclient.upload({
container: cloudStorageContainer,
remote: 'mys3file.ext',
local: '/path/to/local/file'
});
cloudupload.on('error',function(err){
console.error(err);
});
cloudupload.on('success',function(file){
console.log(file);
});
cloudupload.on('end',function(){
console.log('cloudupload ended');
});
localuploadfile.pipe(cloudupload);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment