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

sii-parse-ts

v1.1.1

Published

TypeScript type definitions and parser for ETS2 and ATS .sii save files

Readme

SII Parse TypeScript

TypeScript library for parsing Euro Truck Simulator 2 and American Truck Simulator .sii save files with complete type definitions.

Installation

npm install sii-parse-ts

Usage

import {
  parseSii,
  parseSiiFile,
  parseSiiFileAuto,
  parseSiiFileStreaming,
  ProfileSii,
  GameSii,
} from 'sii-parse-ts';

// Parse SII content string
const siiContent = `SiiNunit
{
user_profile : _nameless.1234 {
 profile_name: "My Profile"
 company_name: "My Company"
}
}`;

const parsed = parseSii<ProfileSii>(siiContent);
console.log(parsed.SiiNunit.user_profile[0].profile_name);

// Parse from file (standard)
const profile = await parseSiiFile<ProfileSii>('./profile.sii');

// Parse with automatic optimization (recommended for unknown file sizes)
const gameSave = await parseSiiFileAuto<GameSii>('./game.sii');

// Parse large files with streaming (>10MB files)
const largeSave = await parseSiiFileStreaming<GameSii>('./large-save.sii');

Performance Features

Automatic Optimization

The library automatically chooses the best parsing method:

// Automatically uses streaming for files >10MB, standard parsing otherwise
const result = await parseSiiFileAuto('./unknown-size-file.sii');

Large File Support

For very large SII files, use streaming to reduce memory usage:

// Recommended for files >10MB
const result = await parseSiiFileStreaming('./large-save-file.sii');

API

Core Functions

  • parseSii<T>(content: string) - Parse SII content string
  • parseSiiFile<T>(path: string) - Parse SII file (async)
  • parseSiiFileSync<T>(path: string) - Parse SII file (sync)

Performance-Optimized Functions

  • parseSiiFileStreaming<T>(path: string) - Parse large SII files (>10MB) with streaming for reduced memory usage
  • parseSiiFileAuto<T>(path: string) - Automatically choose optimal parsing method based on file size
  • parseSiiChunked<T>(content: string, options?) - Parse with chunked processing (future-ready API)

Type-Safe Helpers

  • parseSiiAs<T>(content: string) - Parse SII content with type assertion
  • parseSiiFileAs<T>(path: string) - Parse SII file with type assertion (async)
  • parseSiiFileSyncAs<T>(path: string) - Parse SII file with type assertion (sync)

Validation Functions

  • isValidSiiContent(content: string) - Validate SII content format
  • isValidSiiPath(path: string) - Validate SII file path

Types

  • ProfileSii - Player profile data
  • GameSii - Game save state
  • ControlsSii - Input configuration
  • InfoSii - Save metadata

Supported Formats

Only plaintext SII files (SIIN format) are supported. Encrypted (SCSC) and binary (BSII) formats will throw an error with a clear message.

Error Handling

import { isValidSiiContent, parseSii } from 'sii-parse-ts';

if (isValidSiiContent(content)) {
  const result = parseSii(content);
} else {
  console.log('Invalid or encrypted SII file');
}

Examples

See the examples/ directory for complete usage examples:

npm run example      # JavaScript examples
npm run example:ts   # TypeScript examples

License

MIT