1.0.0 • Published 10 years ago

vinyl-smallest-jpeg v1.0.0

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

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.