5
5
5h4dow2019-12-13 17:14:45
Node.js
5h4dow, 2019-12-13 17:14:45

Downloading parts of request nodejs?

By default, the request library downloads everything into an internal body object, which is stored in RAM. There are files of 5-6GB, which I do not want to stick into the RAM. Tell me how to make a gradual write to a file and is it possible with this library?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladlen Hellsite, 2019-12-13
@5h4dow

You just need to download through the stream :

request('https://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question