@tkzo/js-file-handler
v1.1.0
Published
File handler for JavaScript
Downloads
5
Readme
JS FileHandler
File handler for JavaScript.
Installation
npm i @tkzo/js-file-handler --save
Usage
Import module
JavaScript
import { FileHandler } from './file-handler.js';
TypeScript
import { FileHandler } from '@tkzo/js-file-handler';
Call APIs
Convert blob to base64
FileHandler.toBase64(blob).then(base64 => { // ... });
Convert base64 to blob
const blob = FileHandler.fromBase64(base64);
Resize image
FileHandler.resizeImage(blob, 1200, 'image/jpeg', 0.92).then(blob => { // ... });
Create blob from network image
FileHandler.fromNetwork('https://placekitten.com/200/300').then(blob => { // ... });
Identify MimeType
const mimeType = FileHandler.identifyMimeTypeFromBase64(base64);