Skip to content

ivan-pgh/concurrent-webcrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

concurrent-webcrack

A concurrent wrapper around webcrack that walks a directory tree and unpacks bundles in parallel using worker threads and PQueue, with timeouts and graceful fallbacks.

  • Unpacks webpack/browserify bundles via webcrack
  • Concurrency split for small/large files
  • Worker-based execution with per-task timeout
  • Falls back to pretty-print or copy when unpack fails

How it works

  • Two queues: the tool maintains two PQueue instances running in parallel:
    • Small-file queue for files under the threshold
    • Big-file queue for files above the threshold
  • Routing via sizeLimit: sizeLimit (bytes) decides which queue a file goes to. If sizeLimit is not set, all files go to the small-file queue.
  • Goal: all bundles are intended to be de-bundled. If webcrack succeeds, the unpacked modules are written; if not, it falls back.
  • Timeout/resource guard: each file is processed in a worker thread with a per-task timeout. When a task times out (heavy/complex bundles can be resource-intensive), the worker is terminated and the original file is written (attempting to pretty-print first, otherwise copying as-is).

Installation

npm i @ivan-/concurrent-webcrack

Usage

import unpackFiles from "@ivan-/concurrent-webcrack";

await unpackFiles(
  "/path/to/input-dir",
  "/path/to/output-dir",
  /* sizeLimit */ 2_000_000,
  /* smallConcurrency */ 6,
  /* bigConcurrency */ 2,
  /* timeoutMs */ 60_000
);

Credits

This project is based on and uses webcrack by j4k0xb (MIT). Repository: https://github.com/j4k0xb/webcrack

See THIRD_PARTY_NOTICES.md for license details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published