Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaned up the description a bit

  • Loading branch information...
commit 9a1ae2c393f6444d220dee8d9349843a2e5fce98 1 parent 534dad2
@sjmulder authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 README.markdown
View
14 README.markdown
@@ -3,12 +3,12 @@ NBT.js
by Sijmen Mulder.
-NBT.js is a JavaScript parser for uncompressed [NBT](http://www.minecraft.net/docs/NBT.txt) archives, for use with [Node.js](http://nodejs.org/).
+NBT.js is a JavaScript parser [NBT](http://www.minecraft.net/docs/NBT.txt) archives, for use with [Node.js](http://nodejs.org/).
Usage
-----
-After `var nbt = require('nbt')`, you can use `nbt.parse(data)` to convert uncompressed NBT data into a regular JavaScript object.
+After `var nbt = require('nbt')`, you can use `nbt.parse(data, callback)` to convert NBT data into a regular JavaScript object.
var fs = require('fs'),
nbt = require('nbt');
@@ -16,11 +16,14 @@ After `var nbt = require('nbt')`, you can use `nbt.parse(data)` to convert uncom
fs.readFile('bigtest.nbt', function(error, data) {
if (error) throw error;
- var result = nbt.parse(data);
- console.log(result.Level.stringTest);
- console.log(result.Level['nested compound test']);
+ nbt.parse(data, function(error, result) {
+ console.log(result.Level.stringTest);
+ console.log(result.Level['nested compound test']);
+ });
});
+If the data is gzipped, it is automatically decompressed first.
+
Tag names are copied verbatim, and as some names are not valid JavaScript names, use of the indexer may be required – such as with the nested compound test in the example above.
Byte arrays are returned as Node.js `Buffer` objects.
@@ -30,6 +33,7 @@ Known issues
* No formal test cases (only a sample program)
* 64 bit integers overflow
+ * Unicode may not be handled correctly for gzipped archives
Copyright
---------
Please sign in to comment.
Something went wrong with that request. Please try again.