Closed tenoriojuann closed 6 years ago
I end up with a corrupted image when looping through a node's attachments and downloading the attachment.
I am probably making some silly mistake but I saw no other information for this method other than it downloads the image.
//const path = ... //const node = ... //const fs = ... node.listAttachments().each(function () { const attachment = this; if (attachment.getId() === 'default') { attachment.download(function (binaryData) { fs.writeFile(path, binaryData, 'binary', function (err) { if(err){ // do something else } }); if (!binaryData) { // do something else } }) } })
I didn't see anything wrong with your code at first glance. Please send this to support@cloudcms.com so that it can go through the right channels.
This was fixed in a newer commit.
I end up with a corrupted image when looping through a node's attachments and downloading the attachment.
I am probably making some silly mistake but I saw no other information for this method other than it downloads the image.