digitalnodecom / node-red-contrib-generic-s3

Generic S3 nodes for use in Node-RED
https://www.npmjs.com/package/@digitalnodecom/node-red-contrib-generic-s3
Apache License 2.0
3 stars 5 forks source link

Feature put object stream property #36

Closed rristov60 closed 1 year ago

rristov60 commented 1 year ago

This PR extends the Put Object node by adding additional flag Stream (msg.stream) to allow users to upload files by providing body as a stream. We recommend using the following function to convert string body to stream


// Convert stream to string
const streamToString = (stream) =>
    new Promise((resolve, reject) => {
        const chunks = [];
        stream.on("data", (chunk) => chunks.push(chunk));
        stream.on("error", reject);
        stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
    });