binary2ascii
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

npm GitHub stars GitHub issues GitHub license CI via GitHub Actions

English | 简体中文

binary2ascii

ArrayBuffer to Base64-string

Install

// npm
$ npm install --save binary2ascii

// yarn
$ yarn add binary2ascii

// pnpm
$ pnpm add binary2ascii

Usage

ES6 Module

// Note that there is no default export
import { binary2ascii } from 'binary2ascii';

node.js (commonjs)

// Note that there is no default export
const { binary2ascii } = require('binary2ascii')

Use

const arrayBuffer = Uint8Array.from([65])

// Input ArrayBuffer
binary2ascii(arrayBuffer.buffer)

// Input Uint8Array also support
binary2ascii(arrayBuffer)

Convert Picture

const fs = require('fs')

// Convert Picture data to base64
binary2ascii(fs.readFileSync('./test/test.png').buffer)

Development and construction

Installation Dependencies

$ pnpm install

Repackage

$ pnpm run build

Test

It is necessary to install the development software

$ pnpm run test

Package Sidebar

Install

npm i binary2ascii

Weekly Downloads

6

Version

1.0.1

License

MIT

Unpacked Size

41.4 kB

Total Files

14

Last publish

Collaborators

  • 5102a