Kévin Tessier 04fab6ba46 install gulp | 6 yıl önce | |
---|---|---|
.. | ||
lib | 6 yıl önce | |
node_modules | 6 yıl önce | |
LICENSE | 6 yıl önce | |
README.md | 6 yıl önce | |
index.js | 6 yıl önce | |
package.json | 6 yıl önce |
Package | vinyl |
Description | A virtual file format |
Node Version | >= 0.9 |
Read this for more info about how this plays into the grand scheme of things https://medium.com/@eschoff/3828e8126466
var File = require('vinyl');
var coffeeFile = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee",
contents: new Buffer("test = 123")
});
Type: String
Default: process.cwd()
Used for relative pathing. Typically where a glob starts.
Type: String
Default: options.cwd
Full path to the file.
Type: String
Default: null
The result of an fs.stat call. See fs.Stats for more information.
Type: fs.Stats
Default: null
File contents.
Type: Buffer, Stream, or null
Default: null
Returns true if file.contents is a Buffer.
Returns true if file.contents is a Stream.
Returns true if file.contents is null.
Returns a new File object with all attributes cloned. Custom attributes are deep-cloned.
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.
Returns a pretty String interpretation of the File. Useful for console.log.
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