1.0.1 • Published 1 year ago

binary2ascii v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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