# @esm2cjs/data-uri-to-buffer

> Generate a Buffer instance from a Data URI string. This is a fork of TooTallNate/node-data-uri-to-buffer, but with CommonJS support.

Latest version **4.0.1** (published 2023-04-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @esm2cjs/data-uri-to-buffer
pnpm add @esm2cjs/data-uri-to-buffer
yarn add @esm2cjs/data-uri-to-buffer
bun add @esm2cjs/data-uri-to-buffer
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2023-04-27 |
| First published | 2022-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 12 |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dominic Griesel |
| Maintainers | alcalzone |
| Keywords | data, uri, datauri, data-uri, buffer, convert, rfc2397, 2397 |

## Links

- npm: https://www.npmjs.com/package/@esm2cjs/data-uri-to-buffer
- Repository: https://github.com/esm2cjs/node-data-uri-to-buffer
- Homepage: https://github.com/esm2cjs/node-data-uri-to-buffer#readme
- Issues: https://github.com/TooTallNate/node-data-uri-to-buffer/issues
- Funding: https://github.com/sponsors/AlCalzone
- npm.io page: https://npm.io/package/@esm2cjs/data-uri-to-buffer

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2023-04-27
- 4.0.0 — 2022-08-19

## README

# @esm2cjs/data-uri-to-buffer

This is a fork of https://github.com/TooTallNate/node-data-uri-to-buffer, but automatically patched to support ESM **and** CommonJS, unlike the original repository.

## Install

You can use an npm alias to install this package under the original name:

```
npm i data-uri-to-buffer@npm:@esm2cjs/data-uri-to-buffer
```

```jsonc
// package.json
"dependencies": {
    "data-uri-to-buffer": "npm:@esm2cjs/data-uri-to-buffer"
}
```

but `npm` might dedupe this incorrectly when other packages depend on the replaced package. If you can, prefer using the scoped package directly:

```
npm i @esm2cjs/data-uri-to-buffer
```

```jsonc
// package.json
"dependencies": {
    "@esm2cjs/data-uri-to-buffer": "^ver.si.on"
}
```

## Usage

```js
// Using ESM import syntax
import dataUriToBuffer from "@esm2cjs/data-uri-to-buffer";

// Using CommonJS require()
const dataUriToBuffer = require("@esm2cjs/data-uri-to-buffer").default;
```

> **Note:**
> Because the original module uses `export default`, you need to append `.default` to the `require()` call.

For more details, please see the original [repository](https://github.com/TooTallNate/node-data-uri-to-buffer).

## Sponsoring

To support my efforts in maintaining the ESM/CommonJS hybrid, please sponsor [here](https://github.com/sponsors/AlCalzone).

To support the original author of the module, please sponsor [here](https://github.com/TooTallNate/node-data-uri-to-buffer).

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