binary2ascii
v1.0.1
Published
binary2ascii
Downloads
56
Maintainers
Readme
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