using smush.it service to optimize image(s) in node
install by NPM
npm install node-smushit -guse smushit in shell
//view help
smushit -h
//smash files or directory
smushit file1 file2 file3
//with recursive
smushit file1 file2 file3 -R
//smash file and save by new name
smushit 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 config
smushit -c
//view service endpoint config, indicate the smush.it HTTP service
smushit -c service
//change the config
smushit -c service=http://your-own-service-endpoint/use it in node
varsmushit=require('node-smushit');//smash a single filesmushit.smushit('images/need-to-smash.png');//smash filessmushit.smushit(['file1','fiel2',..]);//smash images in directorysmushit.smushit('images-folder-path');//smash images in directory or the child-directories with recursivesmushit.smushit('images-folder-path',{recursive: true});//smash images and register callbackssmushit.smushit('images-folder-path',{onItemStart: function(item){},onItemComplete: function(e,item,response){},onComplete: function(reports){},service: 'http://my-custom-domain-service/'});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