Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Known file size is required #62

Open
hgwood opened this issue Jul 28, 2016 · 3 comments
Open

Known file size is required #62

hgwood opened this issue Jul 28, 2016 · 3 comments

Comments

@hgwood
Copy link

hgwood commented Jul 28, 2016

gulp-sftp requires the size of all uploaded files to be known, otherwise it crashes on this line: https://github.com/gtg092x/gulp-sftp/blob/master/index.js#L272. Since Gulp is supposed to be the streaming build system, and gulp-sftp is only using the size for logging (it seems), I would suggest removing the requirement. For example, gulp-sftp could only print the progress in percentage if the size is known.

My use case is zipping a folder and uploading it immediately without writing it to the local file system.

I'm willing to make a PR but I would first like a sign from @gtg092x.

@jean343
Copy link

jean343 commented Dec 8, 2016

I agree, I have the opposite use case and I would like to unzip a local archive.tar.gz and ftp it.

  return gulp.src(path)
    .pipe(gunzip())
    .pipe(untar())
    .pipe(sftp({
      host: '***',
    }));

It fails like

var size = file.stat.size;
TypeError: Cannot read property 'size' of null
    at D:\Sites\admin_react\node_modules\gulp-sftp\index.js:272:37

@hgwood
Copy link
Author

hgwood commented Dec 8, 2016

@jean343 The workaround I use currently is this:

const gulpSftp = require('gulp-sftp');
const vinylFs = require('vinyl-fs');
...
.pipe(...)
.pipe(vinylFs.dest(tmp)) // have to do this because gulpSftp needs file sizes
.pipe(gulpSftp({host, user, pass, remotePath}))

gulp.dest instead of vinylFs.dest should work as well.

@daniellacosse
Copy link

made a terrible fork that sort of fixes this https://github.com/daniellacosse/gulp-sftp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants