Gulp: processing concurrency target files; avoid processing * all files * at the same time

I have a large list of images (2874) that I need to optimize with gulp-imagemin, but the OS seems to limit the number of open files. I can change this with ulimit, but it does not feel particularly portable and secure, given the number of files.

This is my current code:

function optimizeImages() {
    return gulp.src('images/*')
        .pipe(imagemin())
        .pipe(gulp.dest(dest));
}

Is there a way to run a plugin on a subset of files at the same time? Like this

function exampleTask() {
    return gulp.src('images/*')
        .pipe(limitConcurrency(imagemin(), 50))
        .pipe(gulp.dest(dest));
}
+4
source share
1 answer

, Gulp , Error: EMFILE, too many open files , . concurrency !

:

npm update gulp
+2

Source: https://habr.com/ru/post/1545569/


All Articles