New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xmcl/nbt

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xmcl/nbt - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

37

index.js

@@ -1,16 +0,25 @@

import { deflate, deflateSync, gunzip, gunzipSync, gzip, gzipSync, inflate, inflateSync } from "zlib";
import NBT, { setZlib } from "./nbt";
import { promisify } from "util";
setZlib({
gzip: promisify(gzip),
ungzip: promisify(gunzip),
inflate: promisify(inflate),
deflate: promisify(deflate),
gzipSync,
gunzipSync,
inflateSync,
deflateSync,
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const zlib_1 = require("zlib");
const nbt_1 = __importStar(require("./nbt"));
exports.NBT = nbt_1.default;
const util_1 = require("util");
nbt_1.setZlib({
gzip: util_1.promisify(zlib_1.gzip),
ungzip: util_1.promisify(zlib_1.gunzip),
inflate: util_1.promisify(zlib_1.inflate),
deflate: util_1.promisify(zlib_1.deflate),
gzipSync: zlib_1.gzipSync,
gunzipSync: zlib_1.gunzipSync,
inflateSync: zlib_1.inflateSync,
deflateSync: zlib_1.deflateSync,
});
export { NBT };
export default NBT;
exports.default = nbt_1.default;
//# sourceMappingURL=index.js.map

@@ -1,15 +0,27 @@

import NBT, { setZlib } from "./nbt";
import pako from "pako";
setZlib({
gzip(buffer) { return Promise.resolve(pako.gzip(buffer)); },
gzipSync(buffer) { return pako.gzip(buffer); },
ungzip(buffer) { return Promise.resolve(pako.ungzip(buffer)); },
gunzipSync(buffer) { return pako.ungzip(buffer); },
inflate(buffer) { return Promise.resolve(pako.inflate(buffer)); },
deflate(buffer) { return Promise.resolve(pako.deflate(buffer)); },
inflateSync(buffer) { return pako.inflate(buffer); },
deflateSync(buffer) { return pako.deflate(buffer); },
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const nbt_1 = __importStar(require("./nbt"));
exports.NBT = nbt_1.default;
const pako_1 = __importDefault(require("pako"));
nbt_1.setZlib({
gzip(buffer) { return Promise.resolve(pako_1.default.gzip(buffer)); },
gzipSync(buffer) { return pako_1.default.gzip(buffer); },
ungzip(buffer) { return Promise.resolve(pako_1.default.ungzip(buffer)); },
gunzipSync(buffer) { return pako_1.default.ungzip(buffer); },
inflate(buffer) { return Promise.resolve(pako_1.default.inflate(buffer)); },
deflate(buffer) { return Promise.resolve(pako_1.default.deflate(buffer)); },
inflateSync(buffer) { return pako_1.default.inflate(buffer); },
deflateSync(buffer) { return pako_1.default.deflate(buffer); },
});
export { NBT };
export default NBT;
exports.default = nbt_1.default;
//# sourceMappingURL=index.module.js.map

@@ -1,9 +0,15 @@

import ByteBuffer from "bytebuffer";
import fileType from "file-type";
import { readUTF8, writeUTF8 } from "./utils";
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const bytebuffer_1 = __importDefault(require("bytebuffer"));
const file_type_1 = __importDefault(require("file-type"));
const utils_1 = require("./utils");
let zlib;
export function setZlib(lib) {
function setZlib(lib) {
zlib = lib;
}
export var NBT;
exports.setZlib = setZlib;
var NBT;
(function (NBT) {

@@ -92,3 +98,3 @@ let TagType;

},
{ read: (buf) => readUTF8(buf), write: (buf, v) => writeUTF8(buf, v ? v : "") },
{ read: (buf) => utils_1.readUTF8(buf), write: (buf, v) => utils_1.writeUTF8(buf, v ? v : "") },
{

@@ -145,3 +151,3 @@ read(buf, context) {

for (let tag = 0; (tag = buf.readByte()) !== TagType.End;) {
const name = readUTF8(buf);
const name = utils_1.readUTF8(buf);
const visitor = handlers[tag];

@@ -194,3 +200,3 @@ if (!visitor) {

buf.writeByte(tagType);
writeUTF8(buf, key);
utils_1.writeUTF8(buf, key);
try {

@@ -259,3 +265,3 @@ writer.write(buf, value, context.fork(nextScope));

const doUnzip = normalizeCompress(fileData, option.compressed);
const bb = ByteBuffer.wrap(doUnzip === "none"
const bb = bytebuffer_1.default.wrap(doUnzip === "none"
? fileData

@@ -287,3 +293,3 @@ : doUnzip === "gzip"

const doUnzip = normalizeCompress(fileData, option.compressed);
const bb = ByteBuffer.wrap(doUnzip === "none"
const bb = bytebuffer_1.default.wrap(doUnzip === "none"
? fileData

@@ -302,3 +308,3 @@ : doUnzip === "gzip"

if (typeof compressed === "undefined") {
const ft = fileType(fileData);
const ft = file_type_1.default(fileData);
doUnzip = ft !== undefined && ft.ext === "gz" ? "gzip" : "none";

@@ -340,3 +346,3 @@ }

}
const name = readUTF8(buffer); // I think this is the nameProperty of the file...
const name = utils_1.readUTF8(buffer); // I think this is the nameProperty of the file...
const context = new ReadContext(TagType.Compound, reg);

@@ -347,5 +353,5 @@ const value = io[TagType.Compound].read(buffer, context);

function writeRootTag(value, type, reg, filename, io) {
const buffer = new ByteBuffer();
const buffer = new bytebuffer_1.default();
buffer.writeByte(NBT.TagType.Compound);
writeUTF8(buffer, filename || "");
utils_1.writeUTF8(buffer, filename || "");
const context = new WriteContext(type, reg);

@@ -420,6 +426,6 @@ io[NBT.TagType.Compound].write(buffer, value, context);

if (doUnzip !== "none") {
bytebuffer = ByteBuffer.wrap(doUnzip === "gzip" ? await zlib.ungzip(fileData) : await zlib.inflate(fileData));
bytebuffer = bytebuffer_1.default.wrap(doUnzip === "gzip" ? await zlib.ungzip(fileData) : await zlib.inflate(fileData));
}
else {
bytebuffer = ByteBuffer.wrap(fileData);
bytebuffer = bytebuffer_1.default.wrap(fileData);
}

@@ -437,6 +443,6 @@ return readRootTag(bytebuffer, this.reversedRegistry, Object.assign({}, handlers, option.io));

if (doUnzip !== "none") {
bytebuffer = ByteBuffer.wrap(doUnzip === "gzip" ? zlib.gunzipSync(fileData) : zlib.inflateSync(fileData));
bytebuffer = bytebuffer_1.default.wrap(doUnzip === "gzip" ? zlib.gunzipSync(fileData) : zlib.inflateSync(fileData));
}
else {
bytebuffer = ByteBuffer.wrap(fileData);
bytebuffer = bytebuffer_1.default.wrap(fileData);
}

@@ -447,3 +453,3 @@ return readRootTag(bytebuffer, this.reversedRegistry, Object.assign({}, handlers, option.io));

NBT.Serializer = Serializer;
})(NBT || (NBT = {}));
})(NBT = exports.NBT || (exports.NBT = {}));
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze

@@ -464,3 +470,3 @@ function deepFreeze(obj) {

}
export default NBT;
exports.default = NBT;
//# sourceMappingURL=nbt.js.map
{
"name": "@xmcl/nbt",
"version": "1.0.0",
"version": "1.0.1",
"main": "./index.js",

@@ -43,3 +43,3 @@ "module": "./index.module.js",

"homepage": "https://github.com/Voxelum/minecraft-launcher-core-node#readme",
"gitHead": "7babb4628dd072c266a30697d9104aef38215403"
"gitHead": "d3d7dd06d3a3f1363a84f9f2434818cf2935666c"
}
# Nbt Module
[![npm version](https://img.shields.io/npm/v/@xmcl/nbt.svg)](https://www.npmjs.com/package/nbt)
[![npm version](https://img.shields.io/npm/v/@xmcl/nbt.svg)](https://www.npmjs.com/package/@xmcl/nbt)
[![npm](https://img.shields.io/npm/l/@xmcl/minecraft-launcher-core.svg)](https://github.com/voxelum/minecraft-launcher-core-node/blob/master/LICENSE)

@@ -5,0 +5,0 @@ [![Build Status](https://github.com/voxelum/minecraft-launcher-core-node/workflows/Release%20Pre-Check/badge.svg)](https://github.com/voxelum/minecraft-launcher-core-node/workflows/Release%20Pre-Check/badge.svg)

@@ -1,2 +0,4 @@

export function writeUTF8(out, str) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function writeUTF8(out, str) {
const strlen = str.length;

@@ -52,3 +54,4 @@ let utflen = 0;

}
export function readUTF8(buff) {
exports.writeUTF8 = writeUTF8;
function readUTF8(buff) {
const utflen = buff.readUint16();

@@ -123,2 +126,3 @@ const bytearr = new Array(utflen);

}
exports.readUTF8 = readUTF8;
//# sourceMappingURL=utils.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc