#vpk #archive #read-write #extract #content #reading #pak

sourcepak

A library for reading and writing Source engine package files

3 releases

0.1.2 Apr 11, 2024
0.1.1 Feb 29, 2024
0.1.0 Feb 22, 2024

#366 in Game dev

Download history 71/week @ 2024-02-16 174/week @ 2024-02-23 64/week @ 2024-03-01 9/week @ 2024-03-08 9/week @ 2024-03-15 46/week @ 2024-03-22 21/week @ 2024-03-29 140/week @ 2024-04-05 26/week @ 2024-04-12

233 downloads per month

MIT license

89KB
2K SLoC

sourcepak

sourcepak is a Rust crate that provides support for working with VPK (Valve Pak) files. It allows you to read and write VPK files, as well as extract and pack their contents.

Features

  • Read and write VPK files
  • Extract files from VPK archives
  • Optionally memory-map archive files for faster speeds (with the mem-map feature)
  • Pack files into VPK archives

Supported formats

VPK v1 (Alien Swarm, Dota 2, L4D, L4D2, Portal 2, SFM)

  • Read directory files
  • Read file contents
  • Patch existing VPKs
  • Write new VPKs

VPK v2 (CS:GO, CS:S, DoD:S, HL:S, HL2, HL2:DM, Portal, TF2, Source 2)

  • Read directory files
  • Read file contents
  • Patch existing VPKs
  • Write new VPKs

Respawn VPK (Titanfall)

  • Read directory files
  • Read file contents
  • Read audio files
  • Patch existing VPKs
  • Write new VPKs

Documentation

Documentation can be found here

Why does this crate exist?

I originally created the TFVPKTool TypeScript library to support reading Respawn VPK files, along with Harmony VPK Tool using Electron.

I very quickly noticed the issue that these often resulted in high memory use due to language and ecosystem I had used.

With sourcepak I am aiming to fix that.

Dependencies

~100–415KB