/// import { FileHandle } from "fs/promises"; /** * An abstract interface for a file-reading interface. This is used * by the ELF parser to read the file from many different sources. */ export interface Reader { /** The path of the file, if it is a file. */ path?: string; /** Called to open the data source asynchronously. */ open(): Promise; /** * Called to read data from the data source. * @param length The amount of data to read. * @param position If specified, seek to this position first. */ read(length: number, position?: number): Promise; /** * Called to return a data view interface to the data source. * @param length The size of the data view. * @param position The position of the data view. */ view(length: number, position?: number): Promise; /** Returns the size of the data source */ size(): number; /** Closes the data source */ close(): Promise; } export declare function array(array: Array): Reader; export declare function buffer(buffer: TBuffer | ArrayBuffer): Reader; export declare function asyncfile(fh: FileHandle, ownshandle?: boolean): Reader; export declare function syncfile(handle: number, ownshandle?: boolean): Reader; export declare function file(elfpath: string): Reader; /** Blob for the browser and future node */ export interface Blob { readonly size: number; arrayBuffer(): Promise; } export declare function blob(item: Blob): Reader;