1.0.0 • Published 2 years ago

@mertsolak/file-helper v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

File Helper

Package for file management/conversion/download in javascript/typescript

npm license size issue

Installation

Use node package manager to install @mertsolak/file-helper.

npm i @mertsolak/file-helper

Basic Usage

import { convertBase64ToFile, convertFileToBase64, download } from '@mertsolak/file-helper';

// if base64Data does not include mimeType,
// mimeType has to be provided
const imageInFileFormat = await convertBase64ToFile({
  base64Data: 'data:image/jpeg;base64,...',
  fileName: 'image.jpg',
});
const imageInBase64Format = await convertFileToBase64(imageInFileFormat);

// it can download both format
download(imageInFileFormat);
download(imageInBase64Format);