21 lines
894 B
TypeScript
21 lines
894 B
TypeScript
/// <reference types="node" />
|
|
import { IRandomReader } from '../type';
|
|
/**
|
|
* Provides abstract file access via the IRandomRead interface
|
|
*/
|
|
export declare class RandomFileReader implements IRandomReader {
|
|
fileSize: number;
|
|
private readonly fd;
|
|
constructor(filePath: string, fileSize: number);
|
|
/**
|
|
* Read from a given position of an abstracted file or buffer.
|
|
* @param buffer {Buffer} is the buffer that the data will be written to.
|
|
* @param offset {number} is the offset in the buffer to start writing at.
|
|
* @param length {number}is an integer specifying the number of bytes to read.
|
|
* @param position {number} is an argument specifying where to begin reading from in the file.
|
|
* @return {Promise<number>} bytes read
|
|
*/
|
|
randomRead(buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
|
|
close(): void;
|
|
}
|