Answer the question
In order to leave comments, you need to log in
How to show the size / speed / time of information copied over sftp in Node.JS?
There is a task:
The user chooses what will be copied.
Before copying, show the size of the copied information, and during the copying process, the speed and remaining time.
On the server side is Ubuntu 18.04 . The
folders from which the user copies information are screwed from the Win server ball.
To check, I displayed a list of all folders and saw that the size attribute does not show anything.
It can take a long time to recalculate the size of each file before copying, since the volume is from 10-100GB and the number of files from 500-10000
I used the method from the example
conn.on('ready', function() {
conn.sftp(function(err, sftp) {
if (err) throw err;
sftp.readdir(remotePathToList, function(err, list) {
if (err) throw err;
// List the directory in the console
console.dir(list);
// Do not forget to close the connection, otherwise you'll get troubles
conn.end();
});
});
}).connect(connSettings);
Answer the question
In order to leave comments, you need to log in
I realized that you need to calculate the size of all files in folders yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question