jpegtran

The jpegtran utility as a readable/writable stream

BSD-3-Clause 17 个版本
安装
npm install jpegtran
yarn add jpegtran
pnpm add jpegtran
bun add jpegtran
README

node-jpegtran

NPM version Build Status Coverage Status Dependency Status

The jpegtran command line utility as a readable/writable stream.

If you don't have a jpegtran binary in your PATH, node-jpegtran will try to use one of the binaries provided by the node-jpegtran-bin package.

The constructor optionally takes an array of command line options for the jpegtran binary:

var JpegTran = require('jpegtran'),
  myJpegTranslator = new JpegTran(['-rotate', 90, '-progressive']);

sourceStream.pipe(myJpegTranslator).pipe(destinationStream);

JpegTran as a web service (sends back a horizontally flipped grayscale version of the request body):

var JpegTran = require('jpegtran'),
  http = require('http');

http
  .createServer(function (req, res) {
    if (req.headers['content-type'] === 'image/jpeg') {
      res.writeHead(200, { 'Content-Type': 'image/jpeg' });
      req.pipe(new JpegTran(['-grayscale', '-flip', 'horizontal'])).pipe(res);
    } else {
      res.writeHead(400);
      res.end('Feed me a JPEG!');
    }
  })
  .listen(1337);

Installation

Make sure you have node.js and npm installed, then run:

npm install jpegtran

Releases

Changelog

License

3-clause BSD license -- see the LICENSE file for details.

版本列表
2.0.0 2020-11-22
1.1.0 2020-07-22
1.0.6 2019-03-03
1.0.5 2017-02-08
1.0.4 2016-03-31
1.0.3 2016-03-31
1.0.2 2016-03-31
1.0.1 2016-03-31
1.0.0 2016-03-31
0.2.0 2015-07-28
0.1.0 2014-09-22
0.0.6 2014-05-27
0.0.5 2014-03-24
0.0.4 2012-12-11
0.0.3 2012-12-10
0.0.2 2012-12-01
0.0.1 2012-12-01