vinyl-contents-tostring

Convert vinyl file content to string

Usage no npm install needed!

<script type="module">
  import vinylContentsTostring from 'https://cdn.skypack.dev/vinyl-contents-tostring';
</script>

README

vinyl-contents-tostring

Travis npm package Coverage Status Dependency Status devDependency Status

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).