1 # vinyl [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status](https://david-dm.org/wearefractal/vinyl.png?theme=shields.io)](https://david-dm.org/wearefractal/vinyl)
8 <td>Package</td><td>vinyl</td>
12 <td>A virtual file format</td>
22 Read this for more info about how this plays into the grand scheme of things https://medium.com/@eschoff/3828e8126466
27 var File = require('vinyl');
29 var coffeeFile = new File({
32 path: "/test/file.coffee",
33 contents: new Buffer("test = 123")
37 ### constructor(options)
42 Default: `process.cwd()`
46 Used for relative pathing. Typically where a glob starts.
49 Default: `options.cwd`
53 Full path to the file.
60 The result of an fs.stat call. See [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information.
69 Type: `Buffer, Stream, or null`
74 Returns true if file.contents is a Buffer.
78 Returns true if file.contents is a Stream.
82 Returns true if file.contents is null.
86 Returns a new File object with all attributes cloned. Custom attributes are deep-cloned.
88 ### pipe(stream[, opt])
90 If file.contents is a Buffer, it will write it to the stream.
92 If file.contents is a Stream, it will pipe it to the stream.
94 If file.contents is null, it will do nothing.
96 If opt.end is false, the destination stream will not be ended (same as node core).
102 Returns a pretty String interpretation of the File. Useful for console.log.
106 Returns path.relative for the file base and file path.
111 var file = new File({
114 path: "/test/file.coffee"
117 console.log(file.relative); // file.coffee
120 [npm-url]: https://npmjs.org/package/vinyl
121 [npm-image]: https://badge.fury.io/js/vinyl.png
122 [travis-url]: https://travis-ci.org/wearefractal/vinyl
123 [travis-image]: https://travis-ci.org/wearefractal/vinyl.png?branch=master
124 [coveralls-url]: https://coveralls.io/r/wearefractal/vinyl
125 [coveralls-image]: https://coveralls.io/repos/wearefractal/vinyl/badge.png
126 [depstat-url]: https://david-dm.org/wearefractal/vinyl
127 [depstat-image]: https://david-dm.org/wearefractal/vinyl.png