nbt
Version:
A parser and serializer for NBT archives
99 lines (60 loc) • 3.29 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Home</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Home</h1>
<h3> </h3>
<section>
<article><h1>NBT.js <a href="https://travis-ci.org/sjmulder/nbt-js"><img src="https://travis-ci.org/sjmulder/nbt-js.png" alt="Build Status"></a></h1><p>By Sijmen Mulder and a host of wonderful contributors.</p>
<p>NBT.js is a JavaScript parser and serializer for <a href="http://wiki.vg/NBT">NBT</a>
archives, for use with <a href="http://nodejs.org/">Node.js</a> or the browser.</p>
<h2>Usage</h2><p>After <code>var nbt = require('nbt')</code> or <code><script src="nbt.js"></script></code>, you can
use <code>nbt.parse(data, callback)</code> to convert NBT data into a regular JavaScript
object.</p>
<pre class="prettyprint source lang-js"><code>var fs = require('fs'),
nbt = require('nbt');
var data = fs.readFileSync('fixtures/bigtest.nbt.gz');
nbt.parse(data, function(error, data) {
if (error) { throw error; }
console.log(data.value.stringTest.value);
console.log(data.value['nested compound test'].value);
});</code></pre><p>If the data is gzipped, it is automatically decompressed first. When running
in the browser, <code>window.zlib</code> is required for this to work.</p>
<p>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.</p>
<h2>API documentation</h2><p>The full documentation generated with JSDoc is available in the docs/
directory and online:</p>
<p>http://sjmulder.github.io/nbt-js/</p>
<h2>Development and testing</h2><pre class="prettyprint source lang-bash"><code>npm install # Install development dependencies
make check # Check code quality with jshint and run tests
make watch # Automatically runs 'make check' every few seconds
make doc # Regenerate the documentation in docs/</code></pre><h2>Copyright</h2><p>I, the copyright holder of this work, hereby release it into the public
domain. This applies worldwide.</p>
<p>In case this is not legally possible: I grant anyone the right to use this
work for any purpose, without any conditions, unless such conditions are
required by law.</p></article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-nbt.html">nbt</a></li></ul><h3>Classes</h3><ul><li><a href="module-nbt.Reader.html">Reader</a></li><li><a href="module-nbt.Writer.html">Writer</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 16 2018 05:05:14 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>