JSPM

binary2ascii

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q54849F
  • License MIT

binary2ascii

Package Exports

  • binary2ascii

Readme

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