Installation
npm i image-handler
Usage
compressImage(OBJECT)
imgHandler
Params descript
Params | Type | Description |
---|---|---|
file | Object | File Object |
quality | Number | The quality of compressing(between 0 - 1), default 0.5 |
maxSize | Number | if the size of file larger than maxSize, handle to compress, default 400*1024 (400kb) |
Callback description
return a Promise Object
<Promise>
fileToUrl(OBJECT)
imgHandler
Params descript
Params | Type | Description |
---|---|---|
file | Object | File Object |
Callback description
return a local file url
// example: blob:null/34fd9c5a-fe01-4811-8154-e91858e323c9 <img src="blob:null/34fd9c5a-fe01-4811-8154-e91858e323c9">