| 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.
npm install tinypngjsvar TinyPng = require("tinypngjs");参数:
-
fromFolder:需要压缩的文件夹
-
outFolder:压缩后图片保存的文件夹
- 可选
- 默认值=fromFolder
-
onProgress:下载进度回调
回调函数:function(res,percent){}
- res: Object,tinyjs压缩图片后返回的json
- percent:Number当前进度
返回值 Promise
var res = await TinyPng.compress("./a/");参数:
- fromImg:需要压缩的图片路径
- outFolder:压缩后图片的图片路径
- 可选
- 默认值=fromImg
返回值 Promise
var res = await TinyPng.compressImg("./a/1.jpg");nodejs版:https://github.com/focusbe/tinypngjs
客户端版:https://github.com/focusbe/tinyImage