Giter VIP home page Giter VIP logo

convert-vinyl-to-vfile's Introduction

convert-vinyl-to-vfile

NPM version Build Status Coverage Status

Code Climate Dependencies DevDependencies

Convert a Vinyl file to a VFile

Install

npm install --save convert-vinyl-to-vfile

Usage

ES2015

import convertVinylToVfile from 'convert-vinyl-to-vfile';
import {join} from 'path';
import VFile from 'vfile';
import Vinyl from 'vinyl';

let vfile, vinylFile;

vinylFile = new Vinyl({
  contents: new Buffer('abe lincoln'),
  path: join('users', 'dustin', 'project', 'awesome.project.md')
});

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

ES5

var convertVinylToVfile = require('convert-vinyl-to-vfile')
  , join = require('path').join
  , VFile = require('vfile')
  , Vinyl = require('vinyl')
  , vfile, vinylFile;

vinylFile = new Vinyl({
  contents: new Buffer('abe lincoln'),
  path: join('users', 'dustin', 'project', 'awesome.project.md')
});

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

convert-vinyl-to-vfile's People

Contributors

dustinspecker avatar greenkeeperio-bot avatar wooorm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.