dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/gulp-remote-src/node_modules/vinyl
Cyryl Płotnicki 2f946d6200 Add .vscode
2016-09-11 10:29:13 +02:00
..
lib Add .vscode 2016-09-11 10:29:13 +02:00
test Add .vscode 2016-09-11 10:29:13 +02:00
.npmignore Add .vscode 2016-09-11 10:29:13 +02:00
.travis.yml Add .vscode 2016-09-11 10:29:13 +02:00
index.js Add .vscode 2016-09-11 10:29:13 +02:00
LICENSE Add .vscode 2016-09-11 10:29:13 +02:00
package.json Add .vscode 2016-09-11 10:29:13 +02:00
README.md Add .vscode 2016-09-11 10:29:13 +02:00

vinyl NPM version Build Status Coveralls Status Dependency Status

Information

Packagevinyl
Description A virtual file format
Node Version >= 0.9

File

var File = require('vinyl');

var coffeeFile = new File({
  cwd: "/",
  base: "/test/",
  path: "/test/file.coffee"
  contents: new Buffer("test = 123")
});

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: null

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()

Returns a new File object with all attributes cloned.

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 true, 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.

relative

Returns path.relative for the file base and file path.

Example:

var file = new File({
  cwd: "/",
  base: "/test/",
  path: "/test/file.coffee"
});

console.log(file.relative); // file.coffee