UNPKG

@runejs/filestore

Version:

Tools for managing the RuneJS filestore.

57 lines (56 loc) 1.63 kB
import { ByteBuffer } from '@runejs/common'; import { type FilestoreChannels } from './data'; import type { FileIndex } from './file-index'; export declare class FileData { /** * The ID of this file within it's File Index. */ readonly fileId: number; /** * The File Index that this file belongs to. */ readonly index: FileIndex; /** * A numeric hash of the file's name. */ nameHash: number; /** * A buffer of the file's raw data. */ content: ByteBuffer; /** * CRC value of the file's data. */ crc: number; /** * Whirlpool value of the file's data. */ whirlpool: ByteBuffer; /** * Version number of the file. */ version: number; /** * The compression method used by the file in storage. */ compression: number; /** * The type of file, either an `archive` or a plain `file`. */ type: 'archive' | 'file'; protected readonly filestoreChannels: FilestoreChannels; private decompressed; /** * Creates a new `FileData` object. * @param fileId The ID of the file within it's File Index. * @param index The File Index that this file belongs to. * @param filestoreChannels The main filestore channel for data access. */ constructor(fileId: number, index: FileIndex, filestoreChannels: FilestoreChannels); /** * Reads the file's raw data from the main disk filestore and decompresses it. * @param keys The XTEA keys. * @returns The decompressed file data buffer. */ decompress(keys?: number[]): ByteBuffer; }