node-smushit
node-smushit =====
Last updated 12 years ago by colorhook .
BSD · Repository · Original npm · Tarball · package.json
$ npm install node-smushit 
SYNC missed versions from official npm registry.

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 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

var smushit = require('node-smushit');
//smash a single file
smushit.smushit('images/need-to-smash.png');

//smash files
smushit.smushit(['file1', 'fiel2', ..]);

//smash images in directory
smushit.smushit('images-folder-path');

//smash images in directory or the child-directories with recursive
smushit.smushit('images-folder-path', {recursive: true});

//smash images and register callbacks
smushit.smushit('images-folder-path', {
    onItemStart: function(item){
	
    },
    onItemComplete: function(e, item, response){
	
    },
    onComplete: function(reports){
	
    },
    service: 'http://my-custom-domain-service/'
});

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

Current Tags

  • 0.5.1                                ...           latest (12 years ago)

6 Versions

  • 0.5.1                                ...           12 years ago
  • 0.5.0                                ...           12 years ago
  • 0.4.0                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE