Skip to content

Instantly share code, notes, and snippets.

@johnhok
Created September 6, 2011 14:51
Show Gist options
  • Save johnhok/1197759 to your computer and use it in GitHub Desktop.
Save johnhok/1197759 to your computer and use it in GitHub Desktop.
Caching file uploads on S3 using knox for node.js
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