Answer the question
In order to leave comments, you need to log in
How to do synchronous operations with file transfer over network in nodejs?
How to implement this chain synchronously (one after the other). I killed all evening, I can’t find anything (
-> Download a picture from a remote server
-> upload it to my server
-> send a picture to another server
-> get a response and make a return from the function in which this all happened.
If possible, directly count photos from one server and send them immediately to another - it will be even better :)
I'm not very familiar with the node, everything is easier in php :)
Answer the question
In order to leave comments, you need to log in
But why synchronously then? If it's about nice syntax, but take
https://www.npmjs.com/package/co
and get something like
Pseudocode
co(function*(){
const imgBytes = yield downloadImageFromServer();
const status = yield uploadToAnotherServer(imgBytes);
return status;
}).then( status => {
console.log(status);
})
and make a return from the function in which it all happened
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question