Skip to content
This repository was 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
dbaikov wants to merge 2 commits into
spmjs:masterfrom
ReflexionMed:master
Open

Emit progress event during file download + delete file on remote server#61
dbaikov wants to merge 2 commits into
spmjs:masterfrom
ReflexionMed:master

Conversation

@dbaikov

@dbaikov dbaikov commented Feb 28, 2016

Copy link
Copy Markdown

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
Copy Markdown

+1

1 similar comment
@francois-travais

Copy link
Copy Markdown

+1

Comment thread lib/client.js
if (err) {
return callback(err);
}
var ps = progressStream({

Copy link
Copy Markdown
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
Copy Markdown
Member

Can you rebase it?

@hkeio

hkeio commented Jan 13, 2017

Copy link
Copy Markdown

+1

@lepture

lepture commented Jan 16, 2017

Copy link
Copy Markdown
Contributor

@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