Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/27.js
Created Aug 6, 2012

Embed
What would you like to do?
streams/piped
var nano = require('nano');
var request = require('request');
var spawn = require('child_process').spawn;
var server = nano('http://127.0.0.1:5984');
var createDbStream = server.db.create('pipe');
createDbStream.on('end', function () {
var db = server.use('pipe');
request
.get('http://nodejs.org/logo.png')
.pipe(db.attachment.insert('nodejs', 'logo.png', null, 'image/png'));
spawn('open', ['http://127.0.0.1:5984/pipe/nodejs/logo.png']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.