npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@paradoxlab/otb

v0.2.0

Published

A TypeScript parser and writer for OTServers `.otb` binary format.

Readme

@paradoxlab/otb

npm license

Parser and writer for OTServers items.otb binary format. Reads item metadata (server IDs, client IDs, flags, and TLV attributes) used by TFS and compatible OTServer implementations.

Installation

npm install @paradoxlab/otb

How to Use

import { readFileSync, writeFileSync } from 'node:fs'
import { Otb } from '@paradoxlab/otb'

// Parse
const file = Otb().load(readFileSync('items.otb'))

console.log(file.count) // total item count

// Access by server ID
const grass = file.get(100)
// → { sid: 100, cid: 1, group: 'ground', flags: OtbFlags, attributes: OtbAttributes }

// Inspect attributes
console.log(grass?.attributes.name)    // 'Grass'
console.log(grass?.attributes.weight) // 0

// Iterate all items
for (const item of file.entries()) {
  if (item.flags.stackable) {
    console.log(item.sid, item.attributes.name)
  }
}

// Mutate and write back
const otb = Otb()
const newFile = otb.load(readFileSync('items.otb'))
newFile.items[0]!.flags.stackable = true
writeFileSync('out.otb', Otb().write(newFile))

// Validate without fully loading
const result = Otb().validate(readFileSync('items.otb'))
// → { ok: true } | { ok: false, error: string }

API

Otb()

Factory returning { load, write, validate }. Unlike DAT/SPR, OTB has no version parameter - the schema version is read from the file header.

.load(buffer: ArrayBuffer | Uint8Array): OtbFile

Parse an items.otb binary. Throws ParseError on malformed input.

.write(data: OtbWriteInput): Uint8Array

Serialize an OtbFile (or compatible object) back to binary. Escape sequences are applied automatically.

.validate(buffer: ArrayBuffer | Uint8Array): { ok: boolean; error?: string }

Check the root node marker and schema version without parsing items.

OtbFile

| Property | Type | Description | |---|---|---| | schemaVersion | number | OTB schema version (typically 3) | | count | number | Total number of items | | items | OtbItem[] | All parsed items | | .get(sid) | OtbItem \| undefined | Look up item by server ID | | .entries() | Iterable<OtbItem> | Iterate all items |

OtbItem

| Property | Type | Description | |---|---|---| | sid | number | Server item ID | | cid | number | Client item ID (DAT lookup key) | | group | OtbGroup | 'none' \| 'ground' \| 'container' \| 'weapon' \| ... | | flags | OtbFlags | Boolean properties: stackable, usable, moveable, pickupable, rotatable, ... | | attributes | OtbAttributes | TLV attributes: name, weight, attack, defense, armor, decayTo, ... |

Format Notes

  • The binary format uses a tree structure: a root node wraps item nodes, each terminated by a 0xFF end-of-node byte.
  • Reserved bytes (0xFD, 0xFE, 0xFF) within item data are escaped with a 0xFD prefix (similar to OTBM). The writer handles this automatically.
  • Attributes are encoded as TLV (type, length, value) sequences. Unknown attribute types are preserved verbatim during round-trips.
  • The schema version in the root node header determines which flags and attribute IDs are valid. Schema version 3 is standard for TFS 1.x.

← Back to paradox-toolkit