gulpjs / vinyl

Virtual file format.
MIT License
1.28k stars 107 forks source link

[Question] How to create a filter which only uploads different size or non existing files? #135

Closed nealoke closed 7 years ago

nealoke commented 7 years ago

I've tried creating this but I'm really not familiar with fs or other native node modules. I've tried something like this but it is not working.

gulp.task('deploy:test', () => {
    const conn = ftp.create(ftpConfig);
    return gulp.src(`${paths.dist}**/*`, { base: './dist/', buffer: false }).pipe(conn.filter(domains.test, (local, remote, cb) => {

        if (!remote) {
            cb(null, local);
        }

        else if (local.stat.mtime > remote.ftp.date || local.stat.size !== remote.ftp.size) {
            cb(null, local);
        }
    }));
});
phated commented 7 years ago

This is not a support forum. Please direct support questions to StackOverflow.