tinify
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

Build Status

Tinify API client for Node.js

Node.js client for the Tinify API, used for TinyPNG and TinyJPG. Tinify compresses your images intelligently. Read more at http://tinify.com.

Documentation

Go to the documentation for the Node.js client.

Installation

Install the API client:

npm install tinify

Or add this to your package.json:

{
  "dependencies": {
    "tinify": "*"
  }
}

Usage

const tinify = require("tinify");
tinify.key = "YOUR_API_KEY";

tinify.fromFile("unoptimized.png").toFile("optimized.png");

Running tests

npm install
npm test

Integration tests

npm install
TINIFY_KEY=$YOUR_API_KEY npm run integration

To test with proxy:

$ docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 mitmproxy/mitmproxy mitmproxy  --listen-host 0.0.0.0

$ TINIFY_PROXY=http://172.17.0.3:8080 npm run integration

License

This software is licensed under the MIT License. View the license.

Package Sidebar

Install

npm i tinify

Weekly Downloads

13,929

Version

1.8.0

License

MIT

Unpacked Size

248 kB

Total Files

21

Last publish

Collaborators

  • tinify