vinyl
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
clone-stats | 1.0.0 | 1.95 kB | MIT | prod | |
clone | 2.1.2 | 5.68 kB | MIT | prod | |
remove-trailing-separator | 1.1.0 | 2.05 kB | ISC | prod | |
replace-ext | 2.0.0 | 2.4 kB | MIT | prod | |
teex | 1.0.1 | 2.1 kB | MIT | prod |
Vinyl is a very flexible and simple metadata object, commonly used in Node.js development, that describes a file. Just like a physical file, the virtual Vinyl file includes important attributes such as path
and contents
. Nonetheless, a Vinyl file is not limited to representing a local file on your system. It can effectively describe files on various file sources, including external services like Dropbox or S3, FTP servers, and more. This feature introduces a standardized file system object format across a multitude of workflows and file sources, enhancing interoperability and efficiency.
To start using Vinyl, make sure to install it first via npm by running npm install --save vinyl
in your project directory. Here is a basic example of how to use Vinyl:
// Require the vinyl package
var Vinyl = require('vinyl');
// Create a new Vinyl file
var jsFile = new Vinyl({
cwd: '/',
base: '/test/',
path: '/test/file.js',
contents: Buffer.from('var x = 123'),
});
// jsFile now contains your file with path data and contents
In this example, we imported the vinyl
package and created a new Vinyl file instance. The cwd
, base
, path
, and contents
properties can be used to customize the Vinyl file's details. It's worth noting that the contents
variable accepts a Buffer, a Stream, or null.
For detailed documentation on Vinyl and it's full API, refer to the official Vinyl GitHub repository. The documentation contains extended information on various Vinyl options, including different instance methods and properties, file handlers management, and even extending Vinyl’s base functionality. The README section also provides other specific usage examples, and explains how to interact and use Vinyl’s virtual file format in more complex scenarios. Remember to always keep your local Vinyl package updated to the latest version to make sure you are utilizing all the benefits the tool provides.