js-blob-downloader
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

js-blob-downloader

JS blob downloader for any web-based project.

Install

npm install js-blob-downloader

or

yarn add js-blob-downloader

See Example

Usage

downloadBlobDisposition

This function will download the BLob using the disposition header to get the file name and extension.

function downloadBlobDisposition(data: Blob, disposition: string, fallbackFileName: string): string;

import downloadBlobDisposition from 'js-blob-downloader';

const disposition = response.request.getResponseHeader('Content-Disposition');

if (disposition) {
  downloadBlobDisposition(response.data, disposition, 'file.pdf');
} else {
  throw new Error('Content-Disposition header is missing');
}

downloadBlob

This function will download the Blob.

function downloadBlob(data: Blob, fileName: string): string;

import { downloadBlob } from 'js-blob-downloader';

downloadBlob(blob, 'file.pdf');

Built with

  • TypeScript

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i js-blob-downloader

    Weekly Downloads

    7

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    9.49 kB

    Total Files

    9

    Last publish

    Collaborators

    • nazrhanmohcine