vinyl / 1.1.1 last updated 2 months ago created on Dec 21st 2013
Install
npm install --save vinyl
Clone
git clone git@github.com:gulpjs/vinyl.git
dependencies
| main |
|
clone | 1.0.2 | MIT |
|
|
clone-stats | 0.0.1 | MIT | |
|
|
replace-ext | 0.0.1 | MIT |
maintainers
versions
22 total
| 1.1.1 | 2 months ago | phated |
| 1.1.0 | 5 months ago | phated |
| 1.0.0 | 6 months ago | fractal |
| 0.5.3 | 7 months ago | fractal |
| 0.5.1 | 7 months ago | fractal |
| 0.5.0 | 10 months ago | fractal |
| 0.4.6 | a year ago | fractal |
| 0.4.5 | a year ago | fractal |
| 0.4.4 | a year ago | fractal |
| 0.4.3 | 2 years ago | fractal |
| 0.4.2 | 2 years ago | fractal |
| 0.4.1 | 2 years ago | fractal |
| 0.4.0 | 2 years ago | fractal |
| 0.3.3 | 2 years ago | fractal |
| 0.3.2 | 2 years ago | fractal |
| 0.3.1 | 2 years ago | fractal |
| 0.3.0 | 2 years ago | fractal |
| 0.2.3 | 2 years ago | fractal |
| 0.2.2 | 2 years ago | fractal |
| 0.2.1 | 2 years ago | fractal |
| 0.2.0 | 2 years ago | fractal |
| 0.1.0 | 2 years ago | fractal |
readme
vinyl
Information
| Package | vinyl |
| Description | A virtual file format |
| Node Version | >= 0.9 |
What is this?
Read this for more info about how this plays into the grand scheme of things https://medium.com/@eschoff/3828e8126466
File
isVinyl
When checking if an object is a vinyl file, you should not use instanceof. Use the isVinyl function instead.
constructor(options)
options.cwd
Type: String
Default: process.cwd()
options.base
Used for relative pathing. Typically where a glob starts.
Type: String
Default: options.cwd
options.path
Full path to the file.
Type: String
Default: undefined
options.history
Path history. Has no effect if options.path is passed.
Type: Array
Default: options.path ? [options.path] : []
options.stat
The result of an fs.stat call. See fs.Stats for more information.
Type: fs.Stats
Default: null
options.contents
File contents.
Type: Buffer, Stream, or null
Default: null
isBuffer()
Returns true if file.contents is a Buffer.
isStream()
Returns true if file.contents is a Stream.
isNull()
Returns true if file.contents is null.
clone([opt])
Returns a new File object with all attributes cloned.
By default custom attributes are deep-cloned.
If opt or opt.deep is false, custom attributes will not be deep-cloned.
If opt.contents is false, it will copy file.contents Buffer's reference.
pipe(stream[, opt])
If file.contents is a Buffer, it will write it to the stream.
If file.contents is a Stream, it will pipe it to the stream.
If file.contents is null, it will do nothing.
If opt.end is false, the destination stream will not be ended (same as node core).
Returns the stream.
inspect()
Returns a pretty String interpretation of the File. Useful for console.log.
contents
The Stream or Buffer of the file as it was passed in via options, or as the result of modification.
For example:
path
Absolute pathname string or undefined. Setting to a different value pushes the old value to history.
history
Array of path values the file object has had, from history[0] (original) through history[history.length - 1] (current). history and its elements should normally be treated as read-only and only altered indirectly by setting path.
relative
Returns path.relative for the file base and file path.
Example:
dirname
Gets and sets path.dirname for the file path.
Example:
basename
Gets and sets path.basename for the file path.
Example:
stem
Gets and sets stem (filename without suffix) for the file path.
Example:
extname
Gets and sets path.extname for the file path.
Example: