Base64 in Byte
Get base64 size in byte
Installation
npm install @reslys/base64inbyte --save-dev
Usage
import { formatBytes, b64inByte } from 'base64inbyte'
const fileSize = b64inByte(yourBase64)
console.log(fileSize) // 3485
const inBytes = formatBytes(fileSize)
console.log(inBytes) // 34.85 kb
Available Methods
b64inByte
Get base64 size in byte
/**
* Get base64 size in byte
* @param {base64} base64
*
* @return {integer} the size in bytes
*/
b64inByte(base64)
formatBytes
Format integer of bytes to readable string such as 34.85 kb
/**
* Format integer of file size
* @param {integer} bytes
*
* @return {string} formatted size
*/
formatBytes(bytes)