0.15.0 • Published 5 years ago

node-thumbnail v0.15.0

Weekly downloads
1,006
License
BSD-2-Clause
Repository
github
Last release
5 years ago

node-thumbnail

npm version Build Status

thumbnail all the things

node-thumbnail creates a queue of images and converts them asynchronously into thumbnails. node-thumbnail has no binary dependencies --- only javascript.

Command-line usage

thumb [options] source/path dest/path

options:

-h, --help
-v, --version

-s SUFFIX, --suffix SUFFIX
-p PREFIX, --prefix PREFIX
-d, --digest
-t TYPE, --hashing-type TYPE

-w, --width

-c NUM, --concurrency NUM

-o, --overwrite
-s, --skip
-i, --ignore
-q, --quiet

API

You can use this library with callbacks, or with promises.

callbacks

var thumb = require('node-thumbnail').thumb;

// thumb(options, callback);

thumb({
  source: 'source/path', // could be a filename: dest/path/image.jpg
  destination: 'dest/path',
  concurrency: 4
}, function(files, err, stdout, stderr) {
  console.log('All done!');
});

default options:

defaults = {
  prefix: '',
  suffix: '_thumb',
  digest: false,
  hashingType: 'sha1', // 'sha1', 'md5', 'sha256', 'sha512'
  width: 800,
  concurrency: <num of cpus>,
  quiet: false, // if set to 'true', console.log status messages will be supressed
  overwrite: false,
  skip: false, // Skip generation of existing thumbnails
  basename: undefined, // basename of the thumbnail. If unset, the name of the source file is used as basename.
  ignore: false, // Ignore unsupported files in "dest"
  logger: function(message) {
    console.log(message);
  }
};

Note you must specify at least source and destination

promises

The options that you can pass in are the same as above.

thumb({
  source: 'src',
  destination: 'dest'
}).then(function() {
  console.log('Success');
}).catch(function(e) {
  console.log('Error', e.toString());
});

Installation

$ npm install node-thumbnail

License

BSD, short and sweet

0.15.0

5 years ago

0.14.0

6 years ago

0.13.0

6 years ago

0.12.0

7 years ago

0.11.0

7 years ago

0.10.0

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.0

8 years ago

0.6.6

8 years ago

0.6.5

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.0

11 years ago

0.3.1

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.0.1

12 years ago