Skip to content

jc3213/promisefilereader.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

promisefilereader.js

Download

Latest

HTML

<script src="https://jc3213.github.io/promisefilereader.js/filereader.js"></script>

TamperMonkey

// @require https://jc3213.github.io/promisefilereader.js/filereader.js

Method

text

let testResult = await PromiseFileReader.text(file);
  • textResult
    • Promise object, which returns text contents of the file as string if fulfilled

json

let jsonResult = await PromiseFileReader.json(file);
  • jsonResult
    • Promise object, which returns the contents of the file as a JSON object if fulfilled

dataURL

let dataResult = await PromiseFileReader.dataURL(file);
  • dataResult
    • Promise object, which returns a data: URL representing the file's content if fulfilled

base64

let base64Result = await PromiseFileReader.base64(file);
  • base64Result
    • Promise object, which returns base64 encoded string of the file's content if fulfilled

arrayBuffer

let bufferResult = await PromiseFileReader.arrayBuffer(file);
  • bufferResult
    • Promise object, which returns an ArrayBuffer representing the file's content if fulfilled

binaryString

let binaryResult = await PromiseFileReader.binaryString(file);
  • binaryResult
    • Promise object, which returns the raw binary string data of the file's content if fulfilled

About

A JavaScript library providing a Promise-based wrapper for the FileReader API

Topics

Resources

License

Stars

Watchers

Forks