An open API service indexing awesome lists of open source software.

https://github.com/writetome51/get-data-url

Async function that returns data URL generated from a File
https://github.com/writetome51/get-data-url

data-url file

Last synced: 3 months ago
JSON representation

Async function that returns data URL generated from a File

Awesome Lists containing this project

README

        

# getDataURL(file: Blob): Promise<string>

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

## Example
Demonstrates usage in an Angular project:

```html

Choose file to generate data url from:

```

```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';
```