I have a stream i am trying to submit the same stream to two different destinations. The first destination is to AWS S3, the second destination is to some other backend via a http request.
const document = fs.createReadStream(process.cwd() + "/test/resources/" + "id/document.jpg");
const s3Response = await submitToS3(document);
const backendResponse = await submitToBackend(document);
From what i understand a stream can only be read once. How can i send the same stream to two different destinations.
I thought about cloning the stream but simply creating a new variable and assigning the stream to that variable does not work.