Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Emit progress event during file download + delete file on remote server #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dbaikov
Copy link

@dbaikov dbaikov commented Feb 28, 2016

Hi folks,

This adds event to monitor file transfer progress for file download.
Change is based on https://github.com/freeall/progress-stream package

related issues #43 #57

Example:

var pretty = require('prettysize');
var prettySeconds = require('pretty-seconds');

client.download(src, dest, callback)
self.client.on('progress', function (progress) {
    console.log(Math.floor(progress.percentage) + ' %');
    console.log(pretty(progress.speed) + '/sec');
    console.log(prettySeconds(progress.eta));
});
5 %
3.4 MB/sec
1 minute and 35 seconds

Also this adds unlink method to delete file on remote server

client.unlink(filename, callback) -> callback(err)

This changes allows to monitor file transfer progress

related issues spmjs#43 spmjs#57
@scotthovestadt
Copy link

+1

1 similar comment
@francois-travais
Copy link

+1

if (err) {
return callback(err);
}
var ps = progressStream({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should listen error event on ps.

@popomore
Copy link
Member

Can you rebase it?

@hkeio
Copy link

hkeio commented Jan 13, 2017

+1

@lepture
Copy link
Contributor

lepture commented Jan 16, 2017

@dbaikov can you rebase it?

VonLatvala added a commit to VonLatvala/node-scp2 that referenced this pull request Mar 1, 2018
VonLatvala added a commit to VonLatvala/node-scp2 that referenced this pull request Mar 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants