# @writetome51/get-data-url

> Async function that returns data URL generated from a File

Latest version **1.0.0** (published 2020-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @writetome51/get-data-url
pnpm add @writetome51/get-data-url
yarn add @writetome51/get-data-url
bun add @writetome51/get-data-url
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-08-07 |
| First published | 2020-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | extract, data-url, data, url, read, file, blob, reader |

## Links

- npm: https://www.npmjs.com/package/@writetome51/get-data-url
- Repository: https://github.com/writetome51/get-data-url
- Homepage: https://github.com/writetome51/get-data-url#readme
- Issues: https://github.com/writetome51/get-data-url/issues
- npm.io page: https://npm.io/package/@writetome51/get-data-url

## Dependencies (1)

- [@writetome51/file-reader-service](https://npm.io/package/@writetome51/file-reader-service.md) ^1.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-08-07
- 0.0.2 — 2020-03-10
- 0.0.1 — 2020-01-22

## README

# getDataURL(file: Blob): Promise&lt;string&gt;

An async function that returns a data URL generated from `file`.


## Example
Demonstrates usage in an Angular project:

```html
<!--  
// example.component.html
Get a File from a file <input> and pass it to a component method:  
-->
<p>Choose file to generate data url from:</p>
<input type="file"  (change)="addToURLs($event.target.files[0])"/>
```

```ts
// example.component.ts:

export class ExampleComponent {
    dataURLs = [];

    async addToURLs(file) {
        let url = await getDataURL(file); // extracts url
        this.dataURLs.push(url);
    }
}
```

## Installation
```bash
npm i  @writetome51/get-data-url
```

## Loading
```js
import {getDataURL} from '@writetome51/get-data-url';
```

---
_Source: https://npm.io/package/@writetome51/get-data-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
