atomicpages / gulp-download2

A better download utility for gulp
MIT License
6 stars 3 forks source link

Compatibility with gulp 5? #18

Open ptmkenny opened 2 months ago

ptmkenny commented 2 months ago

I'm trying to upgrade from Gulp 4 to Gulp 5 and I'm getting Error: Writable stream closed prematurely.

Here's the relevant function:

const download = require('gulp-download2');

/**
 * Purgecss can only process downloaded files, not URLs.
 */
function downloadPurgeCssPages () {
  console.log('paths.pageDownloads', paths.pageDownloads);
  return gulp.src([paths.pageDownloads])
    .pipe(download(['https://example.com/home']))
    .pipe(rename(function (path) {
      console.log('renaming', path)
      path.extname = '.html';
    }))
    .pipe(gulp.dest('/var/www/html/theme_tools/purgecss_page_downloads'))
}

In the console, I see "renaming" and the path is correct, but then I get the Error: Writable stream closed prematurely error. I don't really understand what this error means.

This comment in the gulp issue queue states that streams using {end: false} are unsupported, but I don't understand what that means, either.

Is gulp-download-2 incompatible with gulp 5?

atomicpages commented 2 months ago

Hey there, thanks for raising this issue. I suspect it's related to hyperrequest which is a dead project. I'll earmark this issue to use a ReadableStream which should address the issue

ptmkenny commented 2 months ago

Thanks, that would be awesome!