Skip to content

ValveResourceFormat/ValvePak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Valve Pak (vpk) for .NET

Build Status (GitHub) NuGet Coverage Status

VPK (Valve Pak) files are uncompressed archives used to package game content. This library allows you to read and extract files out of these paks.

Usage:

using var package = new Package();

// Open a vpk file
package.Read("pak01_dir.vpk");

// Can also pass in a stream
package.Read(File.OpenRead("pak01_dir.vpk"));

// Optionally verify hashes and signatures of the file if there are any
package.VerifyHashes();

// Find a file, this returns a PackageEntry
var file = package.FindEntry("path/to/file.txt");

if (file != null) {
	// Read a file to a byte array
	package.ReadEntry(file, out byte[] fileContents);
}

Do note that files such as pak01_001.vpk are just data files, you have to open pak01_dir.vpk.