Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
gulp-intermediate
Advanced tools
A gulp helper for tools that need files on disk.
Some tools require access to files on disk instead of working with stdin
and stdout
(e.g., Jekyll, Ruby Sass). gulp-intermediate
is a convenience plugin that writes the current vinyl stream to a temporary directory, lets you run commands on the file system, and pushes the results back into the pipe.
NOTE: Writing intermediate files to disk is counter to the gulp philosophy. If possible, use a tool that works with streams. Use gulp-intermediate only if other (better) options aren't available.
$ npm install --save-dev gulp-intermediate
var gulp = require('gulp');
var spawn = require('child-process').spawn;
var intermediate = require('gulp-intermediate');
gulp.task('default', function () {
return gulp.src('app/**/*.jade')
.pipe(intermediate({ output: '_site' }, function (tempDir, cb) {
// Run a command on the files in tempDir and write the results to
// the specified output directory.
var command = spawn('a_command', ['--dest', '_site'], {cwd: tempDir});
command.on('close', cb);
}))
.pipe(gulp.dest('dist'));
});
For more examples see recipes.md.
Type: object
Optional
Type: string
Default: '.'
The directory read back into the stream when processing is finished. Relative to tempDir
.
Type: string
Default: random uuid
The directory that files are written to, relative to the operating system's temporary directry. Defaults to a unique random directory on every run.
The container is emptied before every run.
Type: function
Optional
Run your commands inside the process
callback. process
comes with three arguments:
tempDir
: The absolute path to the directory containing your temporary files. If using spawn
you may want to set the cwd
option to tempDir
.cb
: A callback function to call when the processing is finished. It pushes the output files back into the gulp stream.fileProps
: An object with some information about the files that have been written to the temp directory.
fileProps.cwd
: The original vinyl CWD.The files are written to tempDir
using the vinyl file object's relative path, just like gulp.dest()
writes to the output directory. Make sure you understand how globbing works to avoid unexpected errors: for example, the files in gulp.src(['files/*.json', config.yml])
will all be output at the root of tempDir
.
Consider passing the { base: '.' }
option to glob.src
if you need to output a src glob as it exists on disk. When in doubt, log tempDir
to the console and open it to see what's going on.
FAQs
A gulp helper for tools that need files on disk.
We found that gulp-intermediate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.