# voxelchain-formats

> A collection of tools to work with the VoxelChain file formats

Latest version **0.0.6** (published 2023-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install voxelchain-formats
pnpm add voxelchain-formats
yarn add voxelchain-formats
bun add voxelchain-formats
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2023-01-02 |
| First published | 2023-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 682.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Felix Maier |
| Maintainers | maierfelix |
| Keywords | voxelchain, voxel |

## Links

- npm: https://www.npmjs.com/package/voxelchain-formats
- Repository: https://github.com/voxelchain/voxelchain-formats
- Homepage: https://github.com/voxelchain/voxelchain-formats#readme
- Issues: https://github.com/voxelchain/voxelchain-formats/issues
- npm.io page: https://npm.io/package/voxelchain-formats

## Dependencies (1)

- [pako](https://npm.io/package/pako.md) ^2.0.4

## Recent versions

- 0.0.6 (latest) — 2023-01-02
- 0.0.5 — 2023-01-02

## README

# voxelchain-formats

A collection of tools to work with the [VoxelChain](https://voxelchain.app/) file formats

### Documentation:
The documentation is auto-generated and can be found [here](https://voxelchain.github.io/voxelchain-formats/).

### Installation:
Package installation:
````
npm install voxelchain-formats
````

### Example:
````ts
import * as VoxelChainFormats from "voxelchain-formats";

// Load a .vxwo binary
fetch("world.vxwo").then(resp => resp.arrayBuffer()).then(buffer => {
  // Create an uint8 view into the buffer
  const binary = new Uint8Array(buffer);
  // Decompress the binary data
  const decompressed = VoxelChainFormats.decompressGZIP(binary);
  // Parse the binary data
  const parsed = VoxelChainFormats.parseVXWOFile(decompressed);
  console.log("Parsed world:", parsed);
  // Compile the parsed world back into binary
  const compiled = VoxelChainFormats.compileVXWOFile(parsed);
  // Compress the binary data
  const compressed = VoxelChainFormats.compressGZIP(binary);
  console.log("Re-compiled world:", compressed);
});

````

### Cell Binary Layout
Cells are bitfields with the following layout:

| Offset | Length     | Description
|----------|---------------|-----------------
| 0        | 8          | Material Id
| 8        | 8          | State Data
| 16       | 3          | Animation Index
| 19       | 5          | Rotation Data

### Flow Binary Layout
Flows are bitfields with the following layout:

| Offset | Length     | Description
|----------|---------------|-----------------
| 0        | 4          | Power
| 4        | 1          | Power Signal

---
_Source: https://npm.io/package/voxelchain-formats · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
