1.1.4 • Published 11 months ago

@mann-conomy/tf-parser v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

tf-parser

A Node.js parser for converting Team Fortress 2 game files to JSON objects.

npm version npm downloads Node.js version GitHub actions GitHub license

Installation

Using npm:

$ npm install @mann-conomy/tf-parser

Using yarn:

$ yarn add @mann-conomy/tf-parser

Testing

Using npm:

$ npm test

Using yarn:

$ yarn test

Examples

Parsing UTF-16 encoded language files from the Team Fortress 2 game client into JSON objects.

import { readFile } from "fs/promises";
import { LanguageParser } from "@mann-conomy/tf-parser";

(async () => {
    try {
        // Read the contents of the tf_english.txt file
        const file = await readFile("tf_english.txt", { encoding: "utf16le" });

        // Parse english language translations
        const { lang } = LanguageParser.parse(file);

        console.log(lang.Language); // English
        console.log(lang.Tokens.rarity4); // Unusual
    } catch (error) {
        console.error("Error parsing tf_english.txt", error.message);
    }
})();

Some more examples are available in the examples and test directories.

Documentation

See the Wiki pages for further documentation.

License

MIT

Copyright 2024, The Mann-Conomy Project

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

12 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago