vinyl-contents-tostring
Convert vinyl content into string
Install
$ npm install vinyl-contents-tostring
Usage
const vfs = require('vinyl-fs');
const map = require('map-stream');
const asCallback = require('ascallback');
const vinylToString = require('vinyl-contents-tostring');
vfs.src(['./package.json'])
.pipe(map(
(file, cb) => asCallback(
vinylToString(file).then(contents => console.log(contents)),
cb,
),
));
API
vinylToString(file, enc)
Returns a promise to the contents of the vinyl file, regardless of stream or buffer files. Optionally, it accepts the encoding of the file
License
See the LICENSE file for license rights and limitations (MIT).