Comparing version 0.0.1 to 0.0.2
/// <reference types="node" /> | ||
import * as Long from "long"; | ||
import Long from "long"; | ||
import { Optional } from "typescript-optional"; | ||
@@ -4,0 +4,0 @@ export declare namespace NBT { |
26
index.js
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
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 ByteBuffer = require("bytebuffer"); | ||
const bytebuffer_1 = __importDefault(require("bytebuffer")); | ||
const fileType = require("file-type"); | ||
const Long = require("long"); | ||
const long_1 = __importDefault(require("long")); | ||
const typescript_optional_1 = require("typescript-optional"); | ||
const zlib = require("zlib"); | ||
const zlib = __importStar(require("zlib")); | ||
const utils_1 = require("./utils"); | ||
@@ -62,3 +72,3 @@ var NBT; | ||
case TagType.Long: | ||
return typeof value !== "object" || !(value instanceof Long) || value.unsigned; | ||
return typeof value !== "object" || !(value instanceof long_1.default) || value.unsigned; | ||
case TagType.Float: | ||
@@ -439,3 +449,3 @@ case TagType.Double: | ||
} | ||
const bb = ByteBuffer.wrap(doUnzip ? await new Promise((resolve, reject) => { | ||
const bb = bytebuffer_1.default.wrap(doUnzip ? await new Promise((resolve, reject) => { | ||
zlib.unzip(fileData, (err, r) => { | ||
@@ -466,3 +476,3 @@ if (err) { | ||
async function writeRootTag(value, type, reg, filename, compressed) { | ||
const buffer = new ByteBuffer(); | ||
const buffer = new bytebuffer_1.default(); | ||
buffer.writeByte(NBT.TagType.Compound); | ||
@@ -523,7 +533,7 @@ utils_1.writeUTF8(buffer, filename || ""); | ||
const zip = zlib.unzipSync(fileData); | ||
const bytebuffer = ByteBuffer.wrap(zip); | ||
const bytebuffer = bytebuffer_1.default.wrap(zip); | ||
return readRootTag(bytebuffer, this.reversedRegistry); | ||
} | ||
else { | ||
const bytebuffer = ByteBuffer.wrap(fileData); | ||
const bytebuffer = bytebuffer_1.default.wrap(fileData); | ||
return readRootTag(bytebuffer, this.reversedRegistry); | ||
@@ -530,0 +540,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import * as ByteBuffer from "bytebuffer"; | ||
import ByteBuffer from "bytebuffer"; | ||
import fileType = require("file-type"); | ||
import * as Long from "long"; | ||
import Long from "long"; | ||
import { Optional } from "typescript-optional"; | ||
@@ -5,0 +5,0 @@ import * as zlib from "zlib"; |
{ | ||
"name": "@xmcl/nbt", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "./index.js", | ||
@@ -13,13 +13,3 @@ "types": "./index.d.ts", | ||
}, | ||
"devDependencies": { | ||
"@types/bytebuffer": "^5.0.37", | ||
"@types/long": "^3.0.31", | ||
"@types/mocha": "^2.2.41", | ||
"@types/node": "^10.0.0", | ||
"mocha": "^6.1.4", | ||
"tslint": "^5.14.0", | ||
"typescript": "^3.4.3" | ||
}, | ||
"scripts": { | ||
"test": "node ./node_modules/mocha/bin/mocha test.js --timeout 10000 1>&2", | ||
"build": "tsc --build tsconfig.json" | ||
@@ -49,3 +39,4 @@ }, | ||
}, | ||
"homepage": "https://github.com/ci010/ts-minecraft#readme" | ||
} | ||
"homepage": "https://github.com/ci010/ts-minecraft#readme", | ||
"gitHead": "866ce244b331512e0ada7328b8853c1772b184bf" | ||
} |
{ | ||
"extends": "../../tsconfig.json", | ||
"files": [ | ||
"index.ts", | ||
"utils.ts", | ||
"test.ts" | ||
] | ||
"files": [ | ||
"index.ts", | ||
"utils.ts", | ||
"test.ts" | ||
], | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"module": "commonjs", | ||
"lib": [ | ||
"dom" | ||
], | ||
"experimentalDecorators": true, | ||
"declaration": true, | ||
"sourceMap": true, | ||
"downlevelIteration": true, | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true | ||
} | ||
} |
/// <reference types="bytebuffer" /> | ||
export declare function writeUTF8(out: ByteBuffer, str: string): number; | ||
export declare function readUTF8(buff: ByteBuffer): string; |
@@ -0,0 +0,0 @@ "use strict"; |
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
94094
0
12
1490
1
27