Answer the question
In order to leave comments, you need to log in
How to change image in node.js by link?
I have a link to the image: https://sun1-17.userapi.com/c855128/v855128790/41b... . How can I change the image in the file folder called ava.jpg to the image given in the link?
Answer the question
In order to leave comments, you need to log in
const fs = require('fs');
const {request} = require('https');
request('https://sun1-17.userapi.com/c855128/v855128790/41b1f/gNXADknpXlk.jpg', res => {
res.on('error', console.error).pipe(fs.createWriteStream('/path/to/file/for/save.jpg'));
}).on('error', console.error).end();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question