All Questions
5 questions
4
votes
1
answer
943
views
Prevent memory/connection leaks when piping fetched response to client
Context:
I have some code that looks roughly like this:
const express = require("express");
const app = express();
const fetch = require('node-fetch');
app.get("/file/:path", ...
-1
votes
1
answer
2k
views
Fail to parse on a json stream using node-fetch
I run the sample code from node-fetch stream feature.
Sometime it can successfully parse the chunk, sometimes return error msg SyntaxError: Unexpected token { in JSON at position 312
const fetch = ...
0
votes
1
answer
1k
views
How to write response to stream without waiting end of the fetch?
I need to fetch an audio file and write in a directory. I am worried about that I have to wait end of the fetch to download all the file and then write/save to file. Is that possible to fetch audio ...
0
votes
1
answer
876
views
How do I return a reference to a Readable stream before creating it?
I have a function that needs to return a Readable stream synchronously. I have a function that creates a Readable stream with the data I require, but it's an asynchronous method. How can I return a ...
6
votes
1
answer
16k
views
Proper way to consume NodeJS stream into buffer and write stream
I have a need to pipe a readable stream into both a buffer (to be converted into a string) and a file. The stream is coming from node-fetch.
NodeJS streams have two states: paused and flowing. From ...