Skip to content

myrear/file_reader_promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file_reader_promise

Promise-based FileReader implementation.

Installation

node

npm install @myrear/file_reader_promise

deno

import {
  FileReader,
  readAs,
} from 'https://deno.land/x/file_reader_promise/mod.ts'

Usage

This library provides 2 modules:

readAs

const dataUrl: string = await readAs(reader, file, 'DataURL')
const arrayBuffer: ArrayBuffer = await readAs(reader, file, 'ArrayBuffer')

FileReader

const dataUrl: string = await new FileReader().readAsDataURL(file)
const arrayBuffer: ArrayBuffer = await new FileReader().readAsArrayBuffer(file)