@reslys/base64inbyte

1.4.1 • Public • Published

Base64 in Byte

npm (scoped) npm bundle size (scoped) GitHub license

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)

Package Sidebar

Install

npm i @reslys/base64inbyte

Weekly Downloads

1

Version

1.4.1

License

MIT

Unpacked Size

3.43 kB

Total Files

5

Last publish

Collaborators

  • reslys