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: 6 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-10-20T14:28:37.191Z (18 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
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