New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sc-compression

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sc-compression

Compress and decompress Supercell games assets

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-18.18%
Maintainers
1
Weekly downloads
 
Created
Source

Sc Compression

This module is intended to compress and decompress Supercell assets.
It supports the following signatures:

signaturedescriptiondecompressioncompression
nonenon-compressed file✔️✔️
lzmastarts with bytes 0x5d0000✔️✔️
scstarts with "SC"✔️✔️
sclzstarts with "SC" and contains "SCLZ"✔️✔️
sigstarts with "Sig:"✔️✔️ 🚩
sc2starts with "SC" and contains "START"✔️
zstdcontains 0x28b52ffd✔️

The module automatically infers the right signature when decompress is called.

Install

npm install sc-compression

API Reference

decompress(buffer)

Decompress a file buffer.

  • buffer <Buffer> A compressed file that was read into a Node.js Buffer
  • Returns: <Promise<Buffer>> A decompressed file buffer that can be written to disk

compress(buffer, signature)

Compress a file buffer.

  • buffer <Buffer> A file that was read into a Node.js Buffer
  • signature <string> 'lzma', 'sc', 'sclz' or 'sig'. It is impossible to recompress an sig file with a valid hash, so attempting to load an sig file in an unpatched game client will crash.
  • Returns: <Promise<Buffer>> A compressed file buffer that can be written to disk

readSignature(buffer)

Read a compressed file signature.

  • buffer <Buffer> A compressed file that was read into a Node.js Buffer
  • Returns: <string> The file signature

Example

import { readdir, readFile, writeFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import { decompress } from 'sc-compression';

const files = await readdir('coc-13.0.4/logic');
for (const file of files) {
    const filepath = resolve(directory, file);
    const buffer = await readFile(filepath);
    const decompressed = await decompress(buffer);
    await writeFile(filepath, decompressed);
}

See tests for additional implementation examples.

Step by step guide for non-developers

  • Make sure you have Node.js installed (https://nodejs.org/en/)
  • Run npm install -g sc-compression in a terminal
  • Download examples/decompress.mjs from this repository
  • Run node decompress.mjs in a terminal

Keywords

FAQs

Package last updated on 31 Oct 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc