vinyl-globby

Like globby, but returns vinyl objects instead of filepaths

Usage no npm install needed!

<script type="module">
  import vinylGlobby from 'https://cdn.skypack.dev/vinyl-globby';
</script>

README

vinyl-globby

build status Davis Dependency status

NPM

Like globby, but returns vinyl objects instead of filepaths. Useful when you want to know the relative path to a file from its associated glob pattern.

Example

var vinylGlobby = require("vinyl-globby");

// Standard interface
vinylGlobby(['**/*.js', '!foo.js'], function onGlob(err, files) {
  files[0].path; // Full file path
  files[0].base; // Base from start of glob
  files[0].relative; // Relative file path to base
});

// Emitter interface
var globber = vinylGlobby('**/*.js');
globber.on('match', onMatch);
globber.on('error', onError);
globber.on('end', onEnd);

// You can also abort the globbing, which will fire an "abort" event
globber.abort();

Installation

npm install vinyl-globby

Tests

npm test

NPM scripts

  • npm run cover This runs the tests with code coverage
  • npm run lint This will run the linter on your code
  • npm test This will run the tests.
  • npm run trace This will run your tests in tracing mode.
  • npm run travis This is run by travis.CI to run your tests
  • npm run view-cover This will show code coverage in a browser

Contributors

  • Matt Morgan

MIT Licenced