Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nwtgck/binconv-npm

Repository files navigation

binconv

npm CircleCI

Binary converters for Blob, Uint8Array, ReadableStream, ArrayBuffer, string in JavaScript/TypeScript

Installation

npm i -S binconv

Converters

Here are avaiable converters.
Naming rule: AB should be aToB().

conversion function
Base64Uint8Array base64ToUint8Array()
BlobArrayBuffer blobToArrayBuffer()
BlobReadableStream blobToReadableStream()
BlobUint8Array blobToUint8Array()
ReadableStreamBlob readableStreamToBlob()
ReadableStreamUint8Array readableStreamToUint8Array()
stringUint8Array stringToUint8Array()
stringArrayBuffer stringArrayBuffer()
Uint8ArrayArrayBuffer uint8ArrayToArrayBuffer()
Uint8Array → Base64 uint8ArrayToBase64()
Uint8ArrayBlob uint8ArrayToBlob()
Uint8Array → hex string uint8ArrayToHexString()
Uint8ArrayReadableStream uint8ArrayToReadableStream()
Uint8Arraystring uint8ArrayToString()

Other binary utilities

function mergeUint8Array(a: Uint8Array, b: Uint8Array): Uint8Array;
function mergeAllUint8Arrays(arrays: ReadonlyArray<Uint8Array>): Uint8Array;

Usage

import * as binconv from 'binconv';
const blob = new Blob(["this is a blob"]);
const readableStream = binconv.blobToReadableStream(blob);

Usage (on-demand import)

You can import only specific conversion to reduce file size.

import {blobToReadableStream} from 'binconv/dist/src/blobToReadableStream';
const blob = new Blob(["this is a blob"]);
const readableStream = blobToReadableStream(blob);

About

Converters for Blob, Uint8Array, ReadableStream, ArrayBuffer, string in JavaScript/TypeScript

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

AltStyle によって変換されたページ (->オリジナル) /