(client, remotePath)
| 1 | const { Readable, Writable } = require('stream') |
| 2 | |
| 3 | async function readRemoteFile (client, remotePath) { |
| 4 | return new Promise((resolve, reject) => { |
| 5 | let data = '' |
| 6 | const writable = new Writable({ |
| 7 | write (chunk, encoding, callback) { |
| 8 | data += chunk.toString() |
| 9 | callback() |
| 10 | } |
| 11 | }) |
| 12 | |
| 13 | client.downloadTo(writable, remotePath) |
| 14 | .then(() => resolve(data)) |
| 15 | .catch(reject) |
| 16 | }) |
| 17 | } |
| 18 | |
| 19 | async function writeRemoteFile (client, remotePath, str) { |
| 20 | const readable = new Readable({ |
no test coverage detected