kevva / buffer-to-vinyl

Create a vinyl file or stream from a buffer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

buffer-to-vinyl Build Status

Create a vinyl file or stream from a buffer

Install

$ npm install buffer-to-vinyl

Usage

const fs = require('fs');
const bufferToVinyl = require('buffer-to-vinyl');

bufferToVinyl.file(fs.readFileSync('foo.jpg', null));
bufferToVinyl.stream(fs.readFileSync('foo.jpg', null));

API

bufferToVinyl.file(buffer, [name])

Returns a Vinyl file.

buffer

Type: Buffer

Buffer to create the file from.

name

Type: string

Optional file name.

bufferToVinyl.stream(buffer, [name])

Returns a object PassThrough stream.

buffer

Type: Buffer

Buffer to create the stream from.

name

Type: string

Optional file name.

License

MIT © Kevin Mårtensson

About

Create a vinyl file or stream from a buffer

License:MIT License


Languages

Language:JavaScript 100.0%