J
J
Jan2019-08-24 18:32:07
JavaScript
Jan, 2019-08-24 18:32:07

How to save an image on the client by url?

Hello, there is a task to parse information about machines from the json server.
For each object there is a line with the url of the image, for example https://site.com/audi.jpg.
The machines need to be stored in the client at the first start, this is easy to implement.
The task is to download an image from a remote server and save the image on the client in the images folder, for example. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Stolyarov, 2019-08-24
@Ni55aN

https://www.npmjs.com/package/file-saver

S
Sergey Egorov, 2019-08-24
@SergeyEgorov

Node.js has an https implementation. A couple of handlers per request. An example is here https://nodejs.org/api/https.html#https_https_get_... in the 'data' event we write the received bytes to a file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question