Skip to content

Commit

Permalink
api update
Browse files Browse the repository at this point in the history
  • Loading branch information
extremeheat committed Feb 9, 2021
1 parent 6e12205 commit b104ec0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ async function read(inpf, outf, fmt) {
console.log(`* Dumping NBT file "${inpf}" to "${outf || 'stdout'}" as JSON ${fmt ? 'as ' + fmt : ''}`)

const buffer = await fs.promises.readFile(inpf)
const { result, type } = await nbt.parse(buffer, fmt)
const { parsed, type } = await nbt.parse(buffer, fmt)

if (!fmt) console.log(`(as ${type} endian)`)
if (outf) {
const json = JSON.stringify(result, (k, v) => typeof v === 'bigint' ? v.toString() : v)
const json = JSON.stringify(parsed, (k, v) => typeof v === 'bigint' ? v.toString() : v)
fs.writeFileSync(outf, json)
} else {
console.log(nbt.simplify(result))
console.log(nbt.simplify(parsed))
}

return true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nbt-dump",
"version": "1.0.0",
"version": "1.0.1",
"description": "Read and write Minecraft Named Binary Tag files in big, little and little-varint encoding",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit b104ec0

Please sign in to comment.