@writetome51/file-reader-service
v1.0.0
Published
Abstract TypeScript/JavaScript class that simplifies javascript's built-in FileReader class. Has a getContents() method that begins the reading of a file and returns the result
Downloads
2
Maintainers
Readme
FileReaderService
Abstract TypeScript/JavaScript class that simplifies using FileReader.
Make subclasses that read a file as text, data url, array buffer, or binary string.
Examples
export class TextFileReaderService extends FileReaderService {
constructor(){
super('readAsText');
}
}
export class DataURLFileReaderService extends FileReaderService {
constructor(){
super('readAsDataURL');
}
}
Constructor
constructor(
__readMethod: 'readAsText' | 'readAsDataURL' | 'readAsArrayBuffer' | 'readAsBinaryString'
)
Properties
isReading: boolean // read-only
Methods
async getContents(file: Blob): Promise<any>
Installation
npm i @writetome51/file-reader-service
Loading
import { FileReaderService } from '@writetome51/file-reader-service';