continued dep injectiong

This commit is contained in:
subnub
2024-07-02 15:10:03 -04:00
parent 09cb81f96d
commit 7bd81a9aa5
16 changed files with 413 additions and 336 deletions
+8 -25
View File
@@ -1,27 +1,10 @@
const streamToBuffer = (stream: any, allStreamsToErrorCatch: any[]) => {
const chunks: any[] = []
const streamToBuffer = (stream: any) => {
return new Promise<Buffer>((resolve, reject) => {
const chunks: any[] = [];
stream.on("data", (chunk: any) => chunks.push(chunk));
stream.on("error", reject);
stream.on("end", () => resolve(Buffer.concat(chunks)));
});
};
allStreamsToErrorCatch.forEach((currentStream) => {
currentStream.on("error", (e: Error) => {
console.log("Stream To Buffer Error", e);
reject({
message: "stream to buffer error",
code: 500,
error: e
})
})
})
stream.on('data', (chunk: any) => chunks.push(chunk));
stream.on('error', reject);
stream.on('end', () => resolve(Buffer.concat(chunks)));
})
}
export default streamToBuffer;
export default streamToBuffer;