UNPKG

@bitblit/asyncglk

Version:
53 lines (52 loc) 2.37 kB
import type { FileRef } from '../../common/protocol.js'; import type { GlkOte } from '../../glkote/common/glkote.js'; import type { AutosaveData, ClassicFileStream, ClassicStreamingDialog, DialogOptions } from '../common/interface.js'; export default abstract class NodeStreamingDialog implements ClassicStreamingDialog { 'async': false; abstract classname: string; private extfilepath; private GlkOte?; private is_inited; streaming: true; private userpath; constructor(); init_async(options: DialogOptions, callback: () => void): void; autosave_read(signature: string): AutosaveData | null; autosave_write(signature: string, snapshot: AutosaveData | null): void; file_clean_fixed_name(filename: string, usage: number): string; file_construct_ref(filename?: string, usage?: string, _gameid?: string): FileRef; file_construct_temp_ref(usage: string): FileRef; file_fopen(fmode: number, fref: FileRef): NodeFileStream | null; file_ref_exists(fref: FileRef): boolean; file_remove_ref(fref: FileRef): void; getlibrary(name: string): GlkOte | null; protected get_temp_path(): string; inited(): boolean; protected abstract get_user_path(): string; abstract open(save: boolean, usage: string | null, gameid: string | null | undefined, callback: (fref: FileRef | null) => void): void; } export declare class NodeFileStream implements ClassicFileStream { BufferClass: BufferConstructor; private buffer; /** How much of the buffer is used */ private buflen; /** How much of the buffer has been read out (readmode only) */ private bufmark; /** bufuse is filemode_Read or filemode_Write, if the buffer is being used for reading or writing. For writing, the buffer starts at mark and covers buflen bytes. For reading, the buffer starts at mark amd runs buflen bytes, but bufmark bytes have been consumed from it. */ private bufuse; fd: number | null; private filename; private GlkOte; /** Position in file */ private mark; constructor(fd: number, filename: string, _fmode: number, GlkOte: GlkOte); fclose(): void; fflush(): void; fread(buf: Uint8Array, len?: number): number; fseek(pos: number, seekmode: number): void; ftell(): number; fwrite(buf: Uint8Array, len?: number): number; }