Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including vinyl-paths with all npm packages installed. Try it out:

var vinylPaths = require("vinyl-paths")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

vinyl-paths v3.0.0

Get the file paths in a `vinyl` stream

vinyl-paths Build Status

Get the file paths in a vinyl stream

Useful when you need to use the file paths from a Gulp pipeline in an async Node.js package.

Simply pass an async function such as del and this package will provide each path in the stream as the first argument.


$ npm install vinyl-paths


// gulpfile.js
var gulp = require('gulp');
var stripDebug = require('gulp-strip-debug');
var del = require('del');
var vinylPaths = require('vinyl-paths');

// Log file paths in the stream
gulp.task('log', =>
        .pipe(vinylPaths(async paths => {
            console.log('Paths:', paths);

// Delete files in the stream
gulp.task('delete', =>

// Or if you need to use the paths after the pipeline
gulp.task('delete2', =>
    new Promise(function (resolve, reject) {
        const vp = vinylPaths();

            .on('end', async () => {
                try {
                    await del(vp.paths);
                } catch (error) {

You should only use a vanilla Node.js package like this if you're already using other plugins in the pipeline, otherwise just use the module directly as gulp.src is costly. Remember that Gulp tasks can return promises as well as streams!



The optionally supplied callback will get a file path for every file and is expected to return a promise. An array of the file paths so far is available as a paths property on the stream.




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free