Created
December 16, 2014 19:25
-
-
Save rosskukulinski/d2f754caa9eaef459037 to your computer and use it in GitHub Desktop.
pkgcloud s3 upload ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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