UNPKG

@runejs/filestore

Version:

Tools for managing the RuneJS filestore.

27 lines (26 loc) 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadFilestore = void 0; const common_1 = require("@runejs/common"); const node_fs_1 = require("node:fs"); const node_path_1 = require("node:path"); const loadFilestore = (dir) => { const dataChannel = new common_1.ByteBuffer((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, 'main_file_cache.dat2'))); const indexChannels = []; for (let i = 0; i < 254; i++) { try { const index = new common_1.ByteBuffer((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, `main_file_cache.idx${i}`))); indexChannels.push(index); } catch (error) { break; } } const metaChannel = new common_1.ByteBuffer((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, 'main_file_cache.idx255'))); return { dataChannel, indexChannels, metaChannel, }; }; exports.loadFilestore = loadFilestore;