convert-vinyl-to-vfile
v3.0.0
Published
Convert a Vinyl file to a VFile
Downloads
266
Readme
convert-vinyl-to-vfile
Install
npm install --save convert-vinyl-to-vfile
Usage
const convertVinylToVfile = require('convert-vinyl-to-vfile')
const {join} = require('path');
const VFile = require('vfile');
const Vinyl = require('vinyl');
const vinylFile = new Vinyl({
contents: Buffer.from('abe lincoln'),
path: join('users', 'dustin', 'project', 'awesome.project.md')
});
const vfile = convertVinylToVfile(vinylFile);
/* =>
* new VFile({
* contents: <Buffer 61 62 65 20 6c 69 6e 63 6f 6c 6e>,
* path: 'users/dustin/project/awesome.project.md'
* })
*/
vfile instanceof VFile;
// => true
LICENSE
MIT © Dustin Specker