I realize I'm talking to myself :)

I've updated it to use nano (way cleaner for attachments) and still have a 
endless write loop to couch but file streams ok.  How do I stop it?

im(result.buffer, v.name)
.resize(s.width, s.height)
.autoOrient()
.stream(function (err, stdout, stderr) {
        var writeStream = fs.createWriteStream('./temp/' + fileName);
        stdout.pipe(endue.attachment.insert(dd.id, fileName, null, v.type, { 
rev: dd.rev }));
});

Thanks!
Jeff Charette | Principal 
We Are Charette
web / identity / packaging

m  415.298.2707
w  wearecharette.com
e   [email protected]

On Apr 2, 2013, at 8:53 PM, Jeff Charette <[email protected]> wrote:

> Reformatted post!
> 
> This is a nodejs question concerning couchdb attachments.  It seems too 
> specific to post on stack overflow.  Sorry to ask on here!  I have 2 very 
> long days into this so any help is deeply appreciated!
> 
> I am trying to connect a write stream from graphicsmagic to a readstream in 
> cradle in order to send a document I processed with graphics magic to 
> couchdb. 
> 
> /* this makes the files, but loops infinitely */
> im(result.buffer, v.name)
> .resize(s.width, s.height)
> .autoOrient()
> .write("./temp/" + s.width + 'x' + s.height + v.name, function (err) { // <-- 
> this is the write stream
>       if (!err) {
>               var attachmentData = {
>                 name: s.width + 'x' + s.height + v.name,
>                 'Content-Type': v.type,
>                 body: fs.readFileSync("./temp/" + s.width + 'x' + s.height + 
> v.name) // <-- this is the read stream
>               };
>               db.saveAttachment(docId, attachmentData, function (err, reply) {
>                 if (err) {
>                   console.log(err)
>                   return
>                 }
>                 console.log(reply)
>               });
>       }
> });
> 
> Theses are the docs I am pulling from:
> 
> https://github.com/aheckmann/gm
> https://github.com/cloudhead/cradle
> 
> Is anyone doing this?  Maybe doing it another way?  I don't care whether I 
> use cradle or not just that I send the processed attachment to couch.
> Jeff Charette | Principal 
> We Are Charette
> web / identity / packaging
> 
> m  415.298.2707
> w  wearecharette.com
> e   [email protected]
> 
> On Apr 2, 2013, at 8:22 PM, Jeff Charette <[email protected]> wrote:
> 
>> This is a nodejs question concerning couchdb attachments.  It seems too 
>> specific to post on stack overflow.  I have 2 very long days into this so 
>> any help is deeply appreciated!
>> 
>> I am trying to connect a write stream from graphicsmagic to a readstream in 
>> cradle in order to send a document I processed with graphics magic to 
>> couchdb. 
>> 
>> /* this makes the files, but loops infinitely */
>>                                                                      
>> im(result.buffer, v.name)
>>                                                                      
>> .resize(s.width, s.height)
>>                                                                      
>> .autoOrient()
>>                                                                      
>> .write("./temp/" + s.width + 'x' + s.height + v.name, function (err) { // 
>> <-- this is the write stream
>>                                                                              
>> if (!err) {
>>                                                                              
>>         var attachmentData = {
>>                                                                              
>>           name: s.width + 'x' + s.height + v.name,
>>                                                                              
>>           'Content-Type': v.type,
>>                                                                              
>>           body: fs.readFileSync("./temp/" + s.width + 'x' + s.height + 
>> v.name) // <-- this is the read stream
>>                                                                              
>>         };
>>                                                                              
>>         db.saveAttachment(docId, attachmentData, function (err, reply) {
>>                                                                              
>>           if (err) {
>>                                                                              
>>             console.log(err)
>>                                                                              
>>             return
>>                                                                              
>>           }
>>                                                                              
>>           console.log(reply)
>>                                                                              
>>         });
>>                                                                              
>> }
>>                                                                      });
>> 
>> Theses are the docs I am pulling from:
>> 
>> https://github.com/aheckmann/gm
>> https://github.com/cloudhead/cradle
>> 
>> Is anyone doing this?  Maybe doing it another way?  I don't care whether I 
>> use cradle or not just that I send the processed attachment to couch.
>> 
>> Jeff Charette | Principal 
>> We Are Charette
>> web / identity / packaging
>> 
>> m  415.298.2707
>> w  wearecharette.com
>> e   [email protected]
> 

Reply via email to