Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Eronana/r2pak
A library used to uncompress pak file
https://github.com/Eronana/r2pak
Last synced: 8 days ago
JSON representation
A library used to uncompress pak file
- Host: GitHub
- URL: https://github.com/Eronana/r2pak
- Owner: Eronana
- Created: 2018-03-25T09:24:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-03-25T09:27:48.000Z (over 6 years ago)
- Last Synced: 2024-12-01T16:09:24.388Z (11 days ago)
- Language: TypeScript
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - Eronana/r2pak - A library used to uncompress pak file (TypeScript)
README
r2pak
=====
`r2pak` is a library used to uncompress pak file## Usage
```typescript
import { readPakFromBuffer } from 'r2pak';
import fs from 'fs';const pakFileName = 'test.pak';
const pakFileData = fs.readFileSync(pakFileName);
const files = readPakFromBuffer(pakFileData);
for (const file of files) {
const {
name, size, type, data, isDirectory,
} = file;
if (isDirectory) {
console.log(`mkdir: ${name}`);
fs.mkdirSync(name);
} else {
console.log(`write file: ${name}, size: ${size}`);
fs.writeFileSync(name, data);
}
}
```## API
### readPakFromBuffer(buffer:Buffer)
- `buffer` the pak file buffer
- Returns: File[]### File
- name: string
- type: FileType
- size: number
- isDirectory: boolean
- data: Buffer### FileType
- RAW = 0
- LZSS = 1
- DIRECTORY = 2
- LZSSXOR = 3