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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rw-parser

v1.3.2

Published

Parses RenderWare DFF and TXD files into usable format!

Downloads

33

Readme

RenderWare Binary Stream Parser

npm NPM

Parses RenderWare DFF and TXD files into usable format!

Used in projects

None yet, but feel free to contact us, if you're using the parser in your projects. According to our testings, this parser was successfully used to display GTA: SA models in a web browser without much hassle.

Usage

  1. Install rw-parser using npm install --save rw-parser
  2. Import it either by using plain require:
    const { DffParser } = require('rw-parser');
    // or
    const DffParser = require('rw-parser').DffParser;
    or ES6 syntax:
    import { DffParser } from 'rw-parser';

The beauty of this is you can use it within browser or as a backend with Node.js!

Documentation is not done yet but feel free to ask questions in discussions.

Example

You can parse a DFF and TXD object with the following code:

import { DffParser, TxdParser } from 'rw-parser';

// All types are now exported in index
import type { RwDff, RwTxd } from 'rw-parser';

import { Buffer } from 'buffer';
import { readFileSync } from 'fs';

// Assuming top-level await is supported
// Can be used with browser as well
const resourceUri = 'http://localhost:5321/assets/infernus.dff';
const dffResource = (await fetch(resourceUri)).arrayBuffer();

// Pass Buffer here. If you are developing browser application, use
// a browser shim, like: https://github.com/feross/buffer
const dffParser = new DffParser(Buffer.from(dffResource));

// TXD parsing is practically same, this example just shows
// how to parse via local filesystem in Node
const txdResource = readFileSync('./assets/infernus.txd');
const txdParser = new TxdParser(txdResource);

// Parse TXD and DFF, which will return parsed structure
const txd: RwTxd = txdParser.parse();
const dff: RwDff = dffParser.parse();

Development

  1. Clone the repository or download the source code here
  2. Install dependencies using npm install
  3. Compile TypeScript source files using npm run build
  4. Run tests with npm run tests or tinker with the code a bit, CLI tool is coming soon as well

Optionally, you may set up a task that watches for file changes: npm run dev or tsc -p tsconfig.json --watch.

Please note that this project is still under heavy development. Changes to output structure may happen, so be careful using it in production environment! If you have any questions or problems, feel free to open a discussion.