0.2.1 • Published 1 year ago

pressor v0.2.1

Weekly downloads
4
License
MIT
Repository
github
Last release
1 year ago

Pressor

Pressor is a tool to compress images to target size via canvas in browser

Installing

npm install pressor
// or
yarn add pressor
// or
pnpm add pressor

Usage

compress:

The function signature of compress is:

function compress(file: File, limit: number, accuracy: number): Promise<File>;
  • file: the image file which will be compressed
  • limit: the target size of the compressed file in kb, default to 500
  • accuracy: the accuracy of produced file size, default to 0.8

example:

import { compress } from 'pressor';

const inputChangeHandler = async (evt) => {
  const file = evt.target.files[0];
  const result = await compress(file);
};
0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

4 years ago