vinyl-smallest-jpeg

1.0.0 • Public • Published

vinyl-smallest-jpeg

NPM version Build Status Build status Coverage Status devDependency Status

Create a vinyl file object of theoretically smallest JPEG

var vinylSmallestJpeg = require('vinyl-smallest-jpeg');
 
var fixture = vinylSmallestJpeg();
fixture.contents; //=> <Buffer ff d8 ff e0 00 10 4a 46 49 ...>
fixture.contents.length; //=> 125

It is useful to test image-related gulp plugins.

Installation

Install with npm.

npm install vinyl-smallest-jpeg

API

var vinylSmallestJpeg = require('vinyl-smallest-jpeg');

vinylSmallestJpeg([option])

option: Object
Return: Object (vinyl file object)

It creates a vinyl object whose contents property is a buffer of smallest JPEG (125 bytes).

option

buffer

Type: Boolean
Default: true

If you set this option false, contents property becomes a Readable Stream which emits a JPEG chunk.

var vinylSmallestJpeg = require('vinyl-smallest-jpeg');
 
vinylSmallestJpeg().isBuffer(); //=> true
vinylSmallestJpeg({buffer: false}).isStream(); //=> true

License

Copyright (c) 2014 Shinnosuke Watanabe

Licensed under the MIT License.

Package Sidebar

Install

npm i vinyl-smallest-jpeg

Weekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • shinnn