Library for reading/extracting files from VPK
Project description
VPK is Valve’s file format for storing game assets. This module is able to read the index and individual files.
Install
You can grab the latest release from https://pypi.python.org/pypi/vpk or via pip
pip install vpk
Example usage
The VPK instance is iterable in the standard ways and produces paths to files
import vpk
pak1 = vpk.VPK("/d/Steam/steamapps/common/dota 2 beta/dota/pak01_dir.vpk")
for filepath in pak1:
print filepath
-------------------------------------------------
sound/half_sec_qd.wav
sound/items/guardian_greaves.wav
sound/items/urn_of_shadows.wav
sound/items/rune_bounty.wav
sound/items/refresher.wav
sound/items/item_mael_lightning_04.wav
sound/items/greevil_whistle.wav
...
Reading a specifc file is done by passing the file path to get_file() method, which returns a VPKFile instance, which acts as a regular file instance. Writting is not possible.
pakfile = pak1.get_file("scripts/emoticons.txt")
print pakfile.read().decode('utf-16le')
-------------------------------------------------
"emoticons"
{
// An ID of zero is invalid
"1"
{
"image_name" "wink.png"
"ms_per_frame" "100"
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vpk-0.2.tar.gz
(4.4 kB
view hashes)