# b64-to-blob

> `b64toBlob(b64Data: string, contentType?: string): Blob` converts a base64 string to a Blob object [as described in this Stack Overflow post](https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript).

Latest version **1.2.19** (published 2017-08-21) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install b64-to-blob
pnpm add b64-to-blob
yarn add b64-to-blob
bun add b64-to-blob
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.19 |
| Published | 2017-08-21 |
| First published | 2017-08-20 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | Jeremy Banks |
| Maintainers | jre |

## Links

- npm: https://www.npmjs.com/package/b64-to-blob
- Repository: https://github.com/jeremybanks/b64-to-blob
- Homepage: https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript
- Issues: https://github.com/jeremybanks/b64-to-blob/issues
- npm.io page: https://npm.io/package/b64-to-blob

## Recent versions

- 1.2.19 (latest) — 2017-08-21
- 1.2.18 — 2017-08-20
- 1.2.17 — 2017-08-20
- 1.2.16 — 2017-08-20
- 1.2.15 — 2017-08-20

## README

`b64toBlob(b64Data: string, contentType?: string): Blob` converts a base64
string to a Blob object [as described in this Stack Overflow post](https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript).

Note that the `Blob` class only exists in browsers, not Node, so this package
is only meant for use in the browser and simulated browser environments, not as
part of a typical Node server.

## Example Usage

This module uses the UMD returnExports pattern to export itself for either AMD
or Node/Webpack module loading, falling back to a global browser definition if
neither are available.

### With Webpack

<!-- language: lang-sh -->

    npm install b64-to-blob

<!-- language: lang-js -->

    var b64toBlob = require('b64-to-blob');

    var contentType = 'image/png';
    var b64Data =
        'iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACN' +
        'byblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHx' +
        'gljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==';

    var blob = b64toBlob(b64Data, contentType);

    var blobUrl = URL.createObjectURL(blob);
    window.location = blobUrl;

### Without a Build Step

<!-- language: lang-js -->

    <script src="https://unpkg.com/b64-to-blob"></script>
    <script>
        var contentType = 'image/png';
        var b64Data =
            'iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACN' +
            'byblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHx' +
            'gljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==';

        var blob = b64toBlob(b64Data, contentType);

        var blobUrl = URL.createObjectURL(blob);
        window.location = blobUrl;
    </script>

---
_Source: https://npm.io/package/b64-to-blob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
