Narcissistic Passion Minified
Miss any of our Open RFC calls?Watch the recordings here! »

file-to-array-buffer

1.0.0 • Public • Published

File to ArrayBuffer

Turn a File (or any Blob) into an ArrayBuffer.

Installation

npm install --save file-to-array-buffer

Usage

const fileToArrayBuffer = require('file-to-array-buffer')
 
// <input id="fileItem" type="file" />
const file = document.getElementById('fileItem').files[0]
 
fileToArrayBuffer(file).then((data) => {
  console.log(data)
  //=> ArrayBuffer {byteLength: ...}
})

API

fileToArrayBuffer(file: Blob) => Promise<ArrayBuffer>

Read the data of the file into an ArrayBuffer.

Install

npm i file-to-array-buffer

DownloadsWeekly Downloads

505

Version

1.0.0

License

MIT

Unpacked Size

1.33 kB

Total Files

4

Last publish

Collaborators

  • avatar