knox: Amazon S3 library for Node.js

Some of the best open source software is byproduct of great commercial software. Such is the case with most everything LearnBoost given to the Node.js community. Their latest offering is Knox, TJ’s Amazon S3 client.

Knox was built for Node 0.2.x and offers a Node-like low-level http.Client API. To get started, install via npm

npm install knox

In your Node app, create a Knox client:

var client = knox.createClient({
    key: '<api-key-here>'
  , secret: '<secret-here>'
  , bucket: 'learnboost'

You can now upload something to your S3 bucket via an HTTP PUT:

fs.readFile('', function(err, buf){
  var req = client.put('/test/', {
      'Content-Length': buf.length
    , 'Content-Type': 'text/plain'
  req.on('response', function(res){
    if (200 == res.statusCode) {
      console.log('saved to %s', req.url);

GETing that object again is just as simple:

client.get('/test/').on('response', function(res){
  res.on('data', function(chunk){

Be sure and check the README for more options.

[Source on GitHub]

News Films

Our little film studio focuses on telling developer-centric stories that need to be seen.

GopherCon 2016 Conference Recap

0:00 / 0:00