vinyl-ftp
vinyl-ftp copied to clipboard
`Error: write after end` when trying to fetch a directory from FTP
Hey guys, I really like using vinyl-ftp in my deploy-workflow. And uploading worked so well, I decided to try the other way around (fetching things). But I stumbled across an error unfortunately. My gulp-task looks like that:
const ftpOptions = {
...
parallel: 4,
reload: true,
log: util.log
};
gulp.task('fetch:content', () => {
var connection = ftp.create(ftpOptions);
return connection.src('./content/**/*')
.pipe(gulp.dest('./content_remote/'));
});
The connections seems to establish well and files are loaded properly for a few seconds, but then it just stops at a random file :( (Rarely it even finishes completely) The output looks like that:
[08:22:31] Using gulpfile ~/Developer/website-normannenhaus/gulpfile.js
[08:22:31] Starting 'fetch:content'...
[08:22:31] CONN
[08:22:32] READY
[08:22:32] MLSD /content
[08:22:32] MLSD /content/1-geschichtliches
[08:22:32] CONN
[08:22:32] CONN
[08:22:32] CONN
[08:22:32] GET /content/site.txt
[08:22:32] DOWN 100% /content/site.txt
[08:22:32] READY
[08:22:32] MLSD /content/error
[08:22:32] READY
[08:22:32] MLSD /content/home
[08:22:32] READY
[08:22:32] MLSD /content/impressum
[08:22:32] MLSD /content/veranstaltungen
[08:22:32] GET /content/1-geschichtliches/history.txt
[08:22:32] GET /content/error/error.txt
[08:22:32] GET /content/home/ansicht_01.jpg
[08:22:32] GET /content/home/ansicht_03.jpg
[08:22:32] DOWN 30% /content/1-geschichtliches/history.txt
[08:22:32] DOWN 100% /content/1-geschichtliches/history.txt
...
[08:22:34] DOWN 100% /content/home/img_5082.jpg
[08:22:34] DOWN 100% /content/impressum/imprint.txt
[08:22:34] GET /content/veranstaltungen/events.txt
[08:22:34] 'fetch:content' errored after 2.91 s
[08:22:34] Error: write after end
at writeAfterEnd (_stream_writable.js:166:12)
at Writable.write (_stream_writable.js:217:5)
at PassThrough.ondata (_stream_readable.js:555:20)
at emitOne (events.js:96:13)
at PassThrough.emit (events.js:188:7)
at PassThrough.Readable.read (_stream_readable.js:387:10)
at flow (_stream_readable.js:764:26)
at .<anonymous> (_stream_readable.js:622:7)
at emitNone (events.js:86:13)
at emit (events.js:185:7)
BTW I am using Gulp 4.
Would be awesome to get any support on this.
Regards from Germany, Dennis
Ok, I just have logged the debug-information as well if that helps. I also realised that even in the rare cases where the task finishes without an error, the directory is not completely fetched (sub-sub-dirs are missing).
...
[08:56:08] DOWN 99% /content/home/img_5072.jpg
[08:56:08] DOWN 100% /content/home/img_5078.jpg
[08:56:08] DOWN 99% /content/home/img_5072.jpg
[08:56:08] DOWN 100% /content/home/img_5072.jpg
[08:56:08] [connection] < '226 Transfer complete\r\n'
[08:56:08] [parser] < '226 Transfer complete\r\n'
[08:56:08] [parser] Response: code=226, buffer='Transfer complete'
[08:56:08] [connection] > 'MODE S'
[08:56:08] [connection] < '226 Transfer complete\r\n'
[08:56:08] [parser] < '226 Transfer complete\r\n'
[08:56:08] [parser] Response: code=226, buffer='Transfer complete'
[08:56:08] [connection] > 'MODE S'
[08:56:08] [connection] < '226 Transfer complete\r\n'
[08:56:08] [parser] < '226 Transfer complete\r\n'
[08:56:08] [parser] Response: code=226, buffer='Transfer complete'
[08:56:08] [connection] > 'MODE S'
[08:56:08] [connection] < '200 Mode set to S\r\n'
[08:56:08] [parser] < '200 Mode set to S\r\n'
[08:56:08] [parser] Response: code=200, buffer='Mode set to S'
[08:56:08] GET /content/home/img_5082.jpg
[08:56:08] [connection] > 'PASV'
[08:56:08] CONN
[08:56:08] 'fetch:content' errored after 2.06 s
[08:56:08] Error: write after end
at writeAfterEnd (_stream_writable.js:166:12)
at Writable.write (_stream_writable.js:217:5)
at PassThrough.ondata (_stream_readable.js:555:20)
at emitOne (events.js:96:13)
at PassThrough.emit (events.js:188:7)
at PassThrough.Readable.read (_stream_readable.js:387:10)
at flow (_stream_readable.js:764:26)
at .<anonymous> (_stream_readable.js:622:7)
at emitNone (events.js:86:13)
at emit (events.js:185:7)
I have same issue. v0.6.0 . randomly throw . all subfolders ignored
return conn.src('/www/foo/bar/**/*', {base: '/www/foo'})
.pipe(fs.dest('/www/foo'));
events.js:141
throw er; // Unhandled 'error' event
^
Error: write after end
at writeAfterEnd (//node_modules/parallel-transform/node_modules/readable-stream/lib/_stream_writable.js:276:12)
at Writable.write (//node_modules/parallel-transform/node_modules/readable-stream/lib/_stream_writable.js:320:20)
at PassThrough.ondata (_stream_readable.js:542:20)
at emitOne (events.js:77:13)
at PassThrough.emit (events.js:169:7)
at PassThrough.Readable.read (_stream_readable.js:368:10)
at flow (_stream_readable.js:759:26)
at null.<anonymous> (_stream_readable.js:616:7)
at emitNone (events.js:67:13)
at emit (events.js:166:7)
+1
This is from 2016. Do I have to change libs? :-(