UNPKG

@runejs/filestore

Version:

Tools for managing the RuneJS filestore.

18 lines (17 loc) 570 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hash = hash; exports.getFileNames = getFileNames; const node_fs_1 = require("node:fs"); const node_path_1 = require("node:path"); const parser = require('properties-parser'); function hash(name) { let hash = 0; for (let i = 0; i < name.length; i++) { hash = (Math.imul(31, hash) + name.charCodeAt(i)) | 0; } return hash; } function getFileNames(dir) { return parser.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, 'file-names.properties'))); }