Notify President Madagascar

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

    0.2.0 • Public • Published

    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()

    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);

    Install

    npm i binconv

    DownloadsWeekly Downloads

    137

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    66.8 kB

    Total Files

    76

    Last publish

    Collaborators

    • avatar