UNPKG

@apr144/generic-filehandle

Version:

uniform interface for accessing binary data from local files, remote HTTP resources, and browser Blob data

28 lines (27 loc) 1.08 kB
/// <reference types="node" /> import { GenericFilehandle, FilehandleOptions, Stats } from './filehandle'; /** * Blob of binary data fetched from a local file (with FileReader). * * Adapted by Robert Buels and Garrett Stevens from the BlobFetchable object in * the Dalliance Genome Explorer, which is copyright Thomas Down 2006-2011. */ export default class BlobFile implements GenericFilehandle { private blob; private size; constructor(blob: Blob); read(buffer: Buffer, offset: number | undefined, length: number, position?: number): Promise<{ bytesRead: number; buffer: Buffer; }>; readFile(): Promise<Buffer>; readFile(options: BufferEncoding): Promise<string>; readFile<T extends undefined>(options: Omit<FilehandleOptions, 'encoding'> | (Omit<FilehandleOptions, 'encoding'> & { encoding: T; })): Promise<Buffer>; readFile<T extends BufferEncoding>(options: Omit<FilehandleOptions, 'encoding'> & { encoding: T; }): Promise<string>; stat(): Promise<Stats>; close(): Promise<void>; }