node-smushit
using smush.it service to optimize image(s) in node
How to use?
install by NPM
npm install node-smushit -g
use smushit in shell
//view helpsmushit -h //smash files or directorysmushit file1 file2 file3 //with recursivesmushit file1 file2 file3 -R //smash file and save by new namesmushit image-file-name -o new-file-name /** * change the default service. * by default, `node-smushit` use the !Yahoo smushi.it service, you can create your owne smush service. * If you are in China, you will know how important to create your own smush.it service. * FUCK THE GFW & POOR NETWORK SPEED. */ // view all configsmushit -c //view service endpoint config, indicate the smush.it HTTP servicesmushit -c service //change the configsmushit -c service=http://your-own-service-endpoint/
use it in node
var smushit = ;//smash a single filesmushit; //smash filessmushit; //smash images in directorysmushit; //smash images in directory or the child-directories with recursivesmushit; //smash images and register callbackssmushit;
Changelog
v0.5.1
- modify the lib/smushit.js, change the regexp
/.+\//
->/.+[\/\\]/
bugfix: wrong filename writed to the request body under Windows.
v0.5.0
- modify the cli.js file to unix format for resolving issue #4
v0.4.0
- change path.existsSync to fs.existsSync
v0.3.0
- add custom smushit serivce feature
- add global service config for CLI
- can save the smashed file by new name
v0.2.0
- add callback while the image(s) smashed completed
v0.1.0
- smash by file, filelist, directory