/** * Customized and refactored code originating from * * NBT.js - a JavaScript parser for NBT archives * by Sijmen Mulder * */ /** * A mapping from enum to NBT type numbers. * * @type Object * @see module:nbt.tagTypeNames */ declare enum DataType { END = 0, BYTE = 1, SHORT = 2, INT = 3, LONG = 4, FLOAT = 5, DOUBLE = 6, BYTE_ARRAY = 7, STRING = 8, LIST = 9, COMPOUND = 10, INT_ARRAY = 11, LONG_ARRAY = 12 } export declare class NBTReader { offset: number; arrayView: Uint8Array; dataView: DataView; dataTypeHandler: Record any>; constructor(buffer: Iterable); read(dataType: DataType): any; /** * @param {ArrayBuffer|Buffer} data - an uncompressed NBT archive * @returns {{name: string, value: Object.}} * a named compound * * @see module:nbt.parse * @see module:nbt.writeUncompressed * * @example * nbt.readUncompressed(buf); * // -> { name: 'My Level', * // value: { foo: { type: int, value: 42 }, * // bar: { type: string, value: 'Hi!' }}} */ static parseUncompressed(data: Iterable): { name: any; value: any; }; /** * @callback parseCallback * @param {Object} error * @param {Object} result - a named compound * @param {string} result.name - the top-level name * @param {Object} result.value - the top-level compound */ /** * This accepts both gzipped and uncompressd NBT archives. * If the archive is uncompressed, the callback will be * called directly from this method. For gzipped files, the * callback is async. * * For use in the browser, window.zlib must be defined to decode * compressed archives. It will be passed a Buffer if the type is * available, or an Uint8Array otherwise. * * @param {ArrayBuffer|Buffer} data - gzipped or uncompressed data * @param {parseCallback} callback * * @see module:nbt.parseUncompressed * @see module:nbt.Reader#compound * * @example * nbt.parse(buf, function(error, results) { * if (error) { * throw error; * } * console.log(result.name); * console.log(result.value.foo); * }); */ static parse(data: any, callback: any): void; } export {};