vinyl-contents-tostring
v7.0.0
Published
Convert vinyl file content to string
Downloads
2,832
Readme
vinyl-contents-tostring
Convert vinyl content into string
Install
$ npm install vinyl-contents-tostring
Usage
import { callbackify } from 'node:util';
import vfs from 'vinyl-fs';
import map from 'map-stream';
import toString from 'vinyl-contents-tostring';
vfs.src(['./package.json'])
.pipe(map(
callbackify(file => toString(file).then(contents => console.log(contents))),
));
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).