Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 855 Bytes

README.md

File metadata and controls

41 lines (28 loc) · 855 Bytes

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)