0.6.0 • Published 3 years ago

samune v0.6.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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
0.6.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.1

4 years ago

0.3.0

6 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago