A
A
Alexander2016-08-10 13:15:24
JavaScript
Alexander, 2016-08-10 13:15:24

How to make a proxy for a file stream?

There is such a library https://github.com/request/request you need to send a form from files but before that encrypt it.

const = {
   url: 'http://service.com/upload',
   //...
};
const stream = fs.createReadStream('file.text');
// Так работает
const r = request.post(options).form().append('file', stream);
// так нет
const encrypt = crypto.createCipher(algorithm, password);
const r = request.post(options).form().append('file', stream.pipe(encrypt));

How to change the transferred data without pipe?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question