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
- Host: GitHub
- URL: https://github.com/writetome51/get-data-url
- Owner: writetome51
- License: mit
- Created: 2020-01-22T02:07:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-07T22:28:27.000Z (almost 5 years ago)
- Last Synced: 2025-02-03T09:48:00.626Z (4 months ago)
- Topics: data-url, file
- Language: TypeScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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';
```