You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Jan Lehnardt <ja...@apache.org> on 2013/04/02 21:29:42 UTC
Jan in Dublin
I’ll be in Dublin next week.
Let’s chat all things CouchDB over Coffee.
At The Round House, 13:00–14:00.
http://lanyrd.com/2013/coffee-couchdb-dublin/
See you there! :)
Jan
--
Re: Connecting streams to cradle and couchdb attachments
Posted by Jeff Charette <io...@yahoo.com>.
Nevermind all!
Turns out I was looping the changes feed because it would add a change every time I posted, lol.
Jeff Charette | Principal
We Are Charette
web / identity / packaging
m 415.298.2707
w wearecharette.com
e jeffrey@wearecharette.com
On Apr 2, 2013, at 10:49 PM, Jeff Charette <io...@yahoo.com> wrote:
> 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 jeffrey@wearecharette.com
>
> On Apr 2, 2013, at 8:53 PM, Jeff Charette <io...@yahoo.com> 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 jeffrey@wearecharette.com
>>
>> On Apr 2, 2013, at 8:22 PM, Jeff Charette <io...@yahoo.com> 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 jeffrey@wearecharette.com
>>
>
Re: Connecting streams to cradle and couchdb attachments
Posted by Jeff Charette <io...@yahoo.com>.
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 jeffrey@wearecharette.com
On Apr 2, 2013, at 8:53 PM, Jeff Charette <io...@yahoo.com> 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 jeffrey@wearecharette.com
>
> On Apr 2, 2013, at 8:22 PM, Jeff Charette <io...@yahoo.com> 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 jeffrey@wearecharette.com
>
Re: Connecting streams to cradle and couchdb attachments
Posted by Jeff Charette <io...@yahoo.com>.
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 jeffrey@wearecharette.com
On Apr 2, 2013, at 8:22 PM, Jeff Charette <io...@yahoo.com> 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 jeffrey@wearecharette.com
Connecting streams to cradle and couchdb attachments
Posted by Jeff Charette <io...@yahoo.com>.
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 jeffrey@wearecharette.com
Re: Jan in Dublin
Posted by Noah Slater <ns...@apache.org>.
I am also in Dublin next week and will be with Jan. Looking forward to
meeting some of you.
On 2 April 2013 20:29, Jan Lehnardt <ja...@apache.org> wrote:
> I’ll be in Dublin next week.
>
> Let’s chat all things CouchDB over Coffee.
>
> At The Round House, 13:00–14:00.
>
> http://lanyrd.com/2013/coffee-couchdb-dublin/
>
> See you there! :)
>
> Jan
> --
--
NS
Re: Jan in Dublin
Posted by Noah Slater <ns...@apache.org>.
I am also in Dublin next week and will be with Jan. Looking forward to
meeting some of you.
On 2 April 2013 20:29, Jan Lehnardt <ja...@apache.org> wrote:
> I’ll be in Dublin next week.
>
> Let’s chat all things CouchDB over Coffee.
>
> At The Round House, 13:00–14:00.
>
> http://lanyrd.com/2013/coffee-couchdb-dublin/
>
> See you there! :)
>
> Jan
> --
--
NS
Re: Jan in Dublin
Posted by Jan Lehnardt <ja...@apache.org>.
Hey all,
friendly reminder, this is is tomorrow :)
Cheers
Jan
--
On Apr 2, 2013, at 20:29 , Jan Lehnardt <ja...@apache.org> wrote:
> I’ll be in Dublin next week.
>
> Let’s chat all things CouchDB over Coffee.
>
> At The Round House, 13:00–14:00.
>
> http://lanyrd.com/2013/coffee-couchdb-dublin/
>
> See you there! :)
>
> Jan
> --
Re: Jan in Dublin
Posted by Jan Lehnardt <ja...@apache.org>.
Hey all,
friendly reminder, this is is tomorrow :)
Cheers
Jan
--
On Apr 2, 2013, at 20:29 , Jan Lehnardt <ja...@apache.org> wrote:
> I’ll be in Dublin next week.
>
> Let’s chat all things CouchDB over Coffee.
>
> At The Round House, 13:00–14:00.
>
> http://lanyrd.com/2013/coffee-couchdb-dublin/
>
> See you there! :)
>
> Jan
> --