Socket
Socket
Sign inDemoInstall

r2pak

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    r2pak

A library used to uncompress pak file


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
379 kB
Created
Weekly downloads
 

Readme

Source

r2pak

r2pak is a library used to uncompress pak file

Usage

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

FAQs

Last updated on 25 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc