Skip to content

tinify/tinify-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

711b99d · Feb 20, 2025

History

97 Commits
Feb 20, 2025
Feb 20, 2025
Feb 20, 2025
Feb 20, 2025
Jul 9, 2018
Sep 30, 2021
Feb 20, 2025
Jan 4, 2018
Feb 20, 2025
Feb 20, 2025
Jul 9, 2018
Jul 9, 2018
Feb 20, 2025

Repository files navigation

NPM Version

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.