Answer the question
In order to leave comments, you need to log in
How to pause/resume for streaming?
There is a simple endpoint that returns a large file:
app.get('/', (req, res) => {
const filePath = req.app.get('filePath');
const stream = createReadStream(resolve(filePath, smallFile));
res.writeHead(200, {
'content-type': mime.lookup(stream.path)
});
stream.on('error', res.end());
stream.on('close', res.end());
stream.pipe(res);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question