Convert vinyl content into string
$ npm install vinyl-contents-tostring
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))),
));
Returns a promise to the contents of the vinyl file, regardless of stream or buffer files. Optionally, it accepts the encoding of the file
See the LICENSE file for license rights and limitations (MIT).