1.3.0 • Published 5 months ago

@binary-files/web-file-mover v1.3.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Web File Mover

Web file mover is a collection of small helper methods for moving binary files from a server to the web, and from the web to the user's device.

Get File from Server

getFileFromServer(url: string): Promise<ArrayBuffer>

Calling this function with a url string will return a promise that will resolve with an ArrayBuffer of the file fetched.

Save File to Device

saveFileToDevice(arrayBuffer: ArrayBuffer, filename: string, mimeType?: string): void;

Calling this function with an ArrayBuffer and a file name will trigger a download of the file.

Read File into ArrayBuffer

fileToArrayBuffer(file: File): Promise<ArrayBuffer>

Calling this function with a File you will get a promise that will resolve with the file's contents in an ArrayBuffer.

Read Part of File into ArrayBuffer

fileChunkToArrayBuffer(file: File, startOffset: number, chunkSize: number): Promise<ArrayBuffer>

Calling this function with a File, a startOffset and chunkSize will give you an ArrayBuffer containing a piece of the file starting from startOffset with a byte length of chunkSize.

1.3.0

5 months ago

1.2.0

2 years ago

0.2.0

4 years ago