vinyl-smallest-jpeg

Create a vinyl object of smallest JPEG

Usage no npm install needed!

<script type="module">
  import vinylSmallestJpeg from 'https://cdn.skypack.dev/vinyl-smallest-jpeg';
</script>

README

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.