1.0.5 • Published 4 months ago

bear-node-imagemin v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

bear-node-imagemin

squash + resize typescript package by imagemin + sharp

NPM npm

  • If you don't want to worry about the problems imagemin encounters in the runtime environment, You can use Docker image(bear-imagemin-server) + npm package (bear-imagemin-client) directly
  • If you want to use it directly in the project, just install bear-node-imagemin directly

Install

yarn add -D bear-node-imagemin

How to use

import {lossySquash, losslessSquash} from 'bear-node-imagemin';

const isLossLess = false;
const sourceFile = './example/static/source.png';

const params = {
  quality: isLossLess ? undefined: quality,
  resize: {width: 200, height: 200, ignoreOverflowSize: true},
  extname: 'webp',
};

// file to buff
const bufferData = fs.readFileSync(sourceFile);
const newBuff = isLossLess ?
        await losslessSquash(bufferData, params): // is lossLess
        await lossySquash(bufferData, params); // is lossy

fs.writeFileSync('./example/static/lossySquash/image_1024.png', newBuff);

Use Docker Server + Client

see packages/bear-imagemin-server and packages/bear-imagemin-client

Use CLI

see packages/bear-imagemin-cli

Release

in root dir

$ yarn build
$ npm publish --access=public

Document

License

MIT © imagine10255

1.0.5

4 months ago

1.0.4-alpha.3

4 months ago

1.0.4-alpha.2

4 months ago

1.0.4

4 months ago

1.0.4-alpha.1

4 months ago

1.0.4-alpha.0

1 year ago

1.0.3

1 year ago

1.0.3-alpha.1

1 year ago

1.0.3-alpha.2

1 year ago

1.0.3-alpha.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.15-alpha.6

2 years ago

0.0.15-alpha.5

2 years ago

0.0.15-alpha.4

2 years ago

0.0.15-alpha.3

2 years ago

0.0.15-alpha.2

2 years ago

0.0.15-alpha.1

2 years ago

0.0.11-alpha.1

2 years ago

0.0.11-alpha.0

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago