Package Exports
- vinyl-readfile-promise
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vinyl-readfile-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vinyl-readfile-promise
Promises/A+ version of vinyl-file:
Create a vinyl file from an actual file
var vinylReadFile = require('vinyl-readfile-promise');
vinylReadFile('index.js')
.then(function(file) {
file.path; //=> /root/dir/index.js
file.cwd; //=> /root/dir
})
.catch(), function(err) {
throw err;
});Installation
npm install vinyl-readfile-promiseAPI
var vinylReadFile = require('vinyl-readfile-promise');vinylReadFile(filePath [, options])
filePath: String
options: Object (directly passed to vinyl-file options)
Return: Object (Promise)
When it finish reading a file, it will be fulfilled with a vinyl file object as an argument.
When it fails to read a file, it will be rejected with an error as an argument.
var vinylReadFile = require('vinyl-readfile-promise');
function onFulFilled(file) {
file.isNull(); //=> false
file.isBuffer(); //=> false
file.isBuffer(); //=> true
}
function onRejected(err) {
throw err;
}
vinylReadFile('path/to/file', {buffer: false}).then(onFulFilled, onRejected);License
Copyright (c) Shinnosuke Watanabe
Licensed under the MIT License.