You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.
use the request npm to download the PNG it is viewable
upload the file PNG from my hard drive to Couch - I can view the PNG from Futon.
I cannot use the pipe to get the PNG from my couch server, and attach it to a new document as per the sample from Nuno's blog. The attachment only has 2 bytes and so is a broken PNG.
varrequest=require('request');varfs=require('fs');request('http://localhost:5984/_utils/image/logo.png').pipe(fs.createWriteStream('download_to_fs.png'));// Test #2 --> Pipe not working with nano --// I only get 2 bytes of the image with this one, it is a bad PNG!vardb=require('nano')('http://localhost:5984/test');varrequest=require('request');// {} for empty body as parameter is required but will be piped inrequest.get("http://localhost:5984/_utils/image/logo.png").pipe(db.attachment.insert("piped-in","piped_in.png",{},"image/png"));// Test #3 --> Assumes you have run test #1 from same directory. // However, if I use the local file and post using nano... it works. // Nano seems to be a-okay with file.vardb=require('nano')('http://localhost:5984/test');varfs=require('fs');fs.readFile('logos_kronos.png',function(err,data){if(!err){db.attachment.insert('upload-from-fs','upload_from_fs.png',data,'image/png',{},function(err,body){if(!err)console.log(body);});}});
All the code is at this gist, some is based on http://writings.nunojob.com/2011/08/nano-minimalistic-couchdb-client-for-nodejs.html, and some is based on https://github.com/mikeal/request, and some more is based on this repo's docs.
My code:
https://gist.github.com/e9c4501d68f218ec739a
Basically I can:
This happens on Windows XP and OS X 10.5.8
couch: {"couchdb":"Welcome","version":"1.1.1"}
on Win XP I think it is the same on OS X but I am not at that machine right now.The text was updated successfully, but these errors were encountered: