Skip to content

A Node.js module to decompress and compress game assets from Supercell games

Notifications You must be signed in to change notification settings

FourCinnamon0/sc-compression

 
 

Repository files navigation

sc-compression

This module allows you to compress and decompress Supercell assets. It supports the following signatures:

Value Signature Comment
0 NONE Regular non-compressed file
1 LZMA Starts with 5d 00 00
2 SC Starts with SC
3 SCLZ Starts with SC and contains SCLZ
4 SIG Starts with Sig:

The module automatically finds the right signature when decompress function is called.

Install

npm install git+https://github.com/FourCinnamon0/sc-compression.git

Available methods

  • decompress(buffer) - returns a Buffer
  • compress(buffer, signature) - returns a Buffer
  • readSignature(buffer) - returns a file signature as a Number

Example

const { readdirSync, readFileSync, writeFileSync } = require('fs');
const { resolve } = require('path');
const ScCompression = require('sc-compression');

const directory = 'coc-13.0.4/logic';
readdirSync(directory).forEach((file) => {
    const filepath = resolve(directory, file);
    const buffer = readFileSync(filepath);
    writeFileSync(filepath, ScCompression.decompress(buffer));
});

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.js from this repository
  • Run node decompress.js in a terminal

About

A Node.js module to decompress and compress game assets from Supercell games

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%