gulp-sftp
gulp-sftp copied to clipboard
Known file size is required
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.
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
@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.
made a terrible fork that sort of fixes this https://github.com/daniellacosse/gulp-sftp