vinyl-fs
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
fs-mkdirp-stream | 2.0.1 | 3.35 kB | MIT | prod | |
glob-stream | 8.0.2 | 13.66 kB | MIT | prod | |
graceful-fs | 4.2.11 | 9.57 kB | ISC | prod | |
iconv-lite | 0.6.3 | 186.2 kB | MIT | prod | |
is-valid-glob | 1.0.0 | 2.76 kB | MIT | prod | |
lead | 4.0.0 | 2.3 kB | MIT | prod | |
normalize-path | 3.0.0 | 3.48 kB | MIT | prod | |
resolve-options | 2.0.0 | 3.14 kB | MIT | prod | |
stream-composer | 1.0.2 | 3.47 kB | MIT | prod | |
streamx | 2.16.1 | 48.1 kB | MIT | prod | |
to-through | 3.0.0 | 3.03 kB | MIT | prod | |
value-or-function | 4.0.0 | 3.26 kB | MIT | prod | |
vinyl-sourcemap | 2.0.0 | 5.43 kB | MIT | prod | |
vinyl | 3.0.0 | 7.15 kB | MIT | prod |
Vinyl-fs is a powerful Vinyl adapter for the file system. Not only does it handle file metadata seamlessly, but it provides an effective means of accessing and interacting with these files across diverse sources, which can range from your computer's file system to cloud-based services like S3, Dropbox, etc. It achieves this by exposing methods such as src(globs)
, dest(folder)
and symlink
that respectively produce, consume, and create symbolic representation of Vinyl objects. More so, Vinyl-fs provides extra methods specific to the input/output medium of these file sources.
To use Vinyl-fs, it's essential to install the required dependencies first, as shown below:
var map = require('map-stream');
var vfs = require('vinyl-fs');
Then, create a function, log
, that logs the file path and also sets up a simple pipeline that reads JS files (excluding those in the vendor directory) and writes them to an output directory:
var log = function (file, cb) {
console.log(file.path);
cb(null, file);
};
vfs
.src(['./js/**/*.js', '!./js/vendor/*.js'])
.pipe(map(log))
.pipe(vfs.dest('./output'));
To utilize the full potential of Vinyl-fs, there are other configurable options available such as UTF-8 BOM removal, buffering and reading file contents, handling file modification dates, managing globs, defining actions for symbolic links and more.
For detailed documentation on using Vinyl-fs including its API details, options and more examples, refer to the official GitHub page here. Here you can find further insights into Glob-related options, instructions on how to handle symbolic links on Windows, information on error handling, as well as licensing details. The README on the GitHub repository is the most comprehensive resource for Vinyl-fs documentation.