Skip to content

Instantly share code, notes, and snippets.

@mmalecki
Created January 7, 2012 15:11
Show Gist options
  • Select an option

  • Save mmalecki/1574981 to your computer and use it in GitHub Desktop.

Select an option

Save mmalecki/1574981 to your computer and use it in GitHub Desktop.
Saving attachments with cradle
var fs = require('fs'),
cradle = require('./'),
db = new(cradle.Connection)().database('cradle');
db.save('hello', function (err, doc) {
db.saveAttachment('hello', 'world', 'text/plain', fs.createReadStream('someFile'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment