samune

0.6.0 • Public • Published

Samune

Build Status Code Climate

Generator of thumbnails from URL.

Installation

npm i samune -S

Usage

generate

URL

const Samune = require('samune');

const opts = {
  url: 'https://41.media.tumblr.com/c6c0457f2c6886fc31099b590558c795/tumblr_nw0d6oxTtZ1s21xzoo2_1280.jpg',
  filename: 'test', /* optional */
  dstDir: '/path/to/thumbnails_dir',
}
const samune = new Samune(opts);
samune.generate([30, 120, 240, 480])
.then( thuimbnailFilenameList => console.log(thuimbnailFilenameList) );

=>  [
      { width: 30,
        filename: 'test_w30.jpg',
        path: 'D:/path/to/thumbnails_dir/test_w30.jpg' },
      { width: 120,
        filename: 'test_w120.jpg',
        path: 'D:/path/to/thumbnails_dir/test_w120.jpg' },
      { width: 240,
        filename: 'test_w240.jpg',
        path: 'D:/path/to/thumbnails_dir/test_w240.jpg' },
      { width: 480,
        filename: 'test_w480.jpg',
        path: 'D:/path/to/thumbnails_dir/test_w480.jpg' }
    ]

Filepath

const Samune = require('samune');

const opts = {
  url: '/path/to/test.jpg',
  filename: 'test', /* optional */
  dstDir: '/path/to/thumbnails_dir',
}
const samune = new Samune(opts);
samune.generate([480]);
.then( thuimbnailFilenameList => console.log(thuimbnailFilenameList) );

=>  [
      { width: 480,
        filename: 'test_w480.jpg',
        path: 'D:/path/to/thumbnails_dir/test_w480.jpg' }
    ]

TODO

  • [ ] hash to naming

Readme

Keywords

none

Package Sidebar

Install

npm i samune

Weekly Downloads

1

Version

0.6.0

License

MIT

Unpacked Size

21.1 MB

Total Files

62

Last publish

Collaborators

  • eiurur