Created
September 6, 2011 14:51
-
-
Save johnhok/1197759 to your computer and use it in GitHub Desktop.
Caching file uploads on S3 using knox for node.js
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 knox = require('knox'); | |
var s3client = knox.createClient({ | |
key: 'KEY GOES HERE', | |
secret: 'SECRET GOES HERE', | |
bucket: 'BUCKET NAME GOES HERE' | |
}); | |
var fileHeaders = { | |
'Cache-Control': 'public,max-age=290304000' | |
}; | |
var source = '/tmp/file.jpg'; | |
var destination = '/chomps/file.jpg'; | |
s3client.putFile(source, destination, fileHeaders, function(err, res){ | |
// Completed upload | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment