Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honza/node-thumbnail
Thumbnail worker queue for node.js
https://github.com/honza/node-thumbnail
Last synced: about 6 hours ago
JSON representation
Thumbnail worker queue for node.js
- Host: GitHub
- URL: https://github.com/honza/node-thumbnail
- Owner: honza
- License: other
- Created: 2011-12-30T02:23:08.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-05-16T20:48:28.000Z (over 4 years ago)
- Last Synced: 2024-10-30T12:53:09.518Z (8 days ago)
- Language: JavaScript
- Homepage: http://honza.ca/node-thumbnail/
- Size: 66.4 KB
- Stars: 103
- Watchers: 8
- Forks: 23
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
node-thumbnail
==============[![npm version](https://badge.fury.io/js/node-thumbnail.svg)](https://badge.fury.io/js/node-thumbnail) [![Build Status](https://travis-ci.org/honza/node-thumbnail.svg?branch=master)](https://travis-ci.org/honza/node-thumbnail)
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, --quietAPI
---You can use this library with callbacks, or with promises.
### callbacks
```js
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:
```js
defaults = {
prefix: '',
suffix: '_thumb',
digest: false,
hashingType: 'sha1', // 'sha1', 'md5', 'sha256', 'sha512'
width: 800,
concurrency: ,
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.
```js
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