Skip to content

Async function that returns data URLs representing each File from a passed array of Files

License

Notifications You must be signed in to change notification settings

writetome51/get-data-urls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

getDataURLs(
      files: File[] | FileList
): Promise<string[]>

An async function that gets an array of data URLs generated from files.

Example

<!--  In the html, get array of Files from a file input and pass it to
    a function:  
-->
<p>Choose files to generate data urls from:</p>
<input type="file" multiple  (change)="addToURLs($event.target.files)"/>
// In a javascript component:

async addToURLs(files) {
     let urls = await getDataURLs(files);
     this.dataURLs.push(...urls);
}

Installation

npm i  @writetome51/get-data-urls

Loading

import {getDataURLs} from '@writetome51/get-data-urls';

About

Async function that returns data URLs representing each File from a passed array of Files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published