tinypngjs

1.2.10 • Public • Published

description: 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.

tinypngjs

Install

npm install tinypngjs
var TinyPng = require("tinypngjs");

API

TinyPng.compress(fromFolder,[outFolder,onProgress]);

参数:

  • fromFolder:需要压缩的文件夹

  • outFolder:压缩后图片保存的文件夹

    • 可选
    • 默认值=fromFolder
  • onProgress:下载进度回调

    回调函数:function(res,percent){}

    • res: Object,tinyjs压缩图片后返回的json
    • percent:Number当前进度

返回值 Promise

var res = await TinyPng.compress("./a/");

TinyPng.compressImage(fromImg,[outImg]);

参数:

  • fromImg:需要压缩的图片路径
  • outFolder:压缩后图片的图片路径
    • 可选
    • 默认值=fromImg

返回值 Promise

var res = await TinyPng.compressImg("./a/1.jpg");

Github

nodejs版:https://github.com/focusbe/tinypngjs
客户端版:https://github.com/focusbe/tinyImage

Readme

Keywords

none

Package Sidebar

Install

npm i tinypngjs

Weekly Downloads

5

Version

1.2.10

License

ISC

Unpacked Size

75.4 kB

Total Files

7

Last publish

Collaborators

  • pengzai-dev
  • foliou