In a Nodejs project, I am using PSD.js to generate a png from a psd. I am using the .toPng() method. I would like to go from this png object to a buffer without saving to the file system. I have tried Buffer.from(png) and I have tried using Sharp's sharp(png).toBuffer() without luck. Sharp is then used to modify the png buffer.
const psd = new PSD(fileBuffer);
psd.parse();
if (!psd.image) {
throw 'Error message';
}
const png = psd.image.toPng();
convBuffer = Buffer.from(png);
//await sharp(png).toBuffer() failed
//await png.get() failed
Imageobject - canBuffer.fromwork with that? Thesharpconstructor can't, as far as I can tell from sharp.pixelplumbing.com/api-constructor/#new