$ show gildas-lormeau/SingleFileZ
SingleFileZ is a browser extension (Chrome/Firefox/Edge) and CLI tool that saves complete web pages as self-extracting HTML/ZIP polyglot files. The core output format embeds a ZIP archive containing all page resources (HTML, CSS, images, fonts, frames) inside an HTML wrapper with a JavaScript bootstrap that extracts and displays the page without external dependencies. The extension offers extensive configuration including multiple profiles, URL-based auto-save rules, cloud uploads (Google Drive, Dropbox, GitHub, WebDAV), an annotation editor for notes/highlights/cut operations, batch saving, and file name templating. Architecturally, the project is a multi-browser extension with background scripts orchestrating page capture, content scripts handling in-page UI and resource collection, and a task queue for managing parallel saves. It relies heavily on message passing between contexts and includes custom infrastructure: a binary serialization format (YABSON) for efficient data transfer, a full ZIP read/write library with support for encryption and streaming, and a fork of Mozilla's Readability.js for article extraction. The CLI component uses Docker to run headlessly, delegating to the `single-filez-cli` npm package. The codebase is large and feature-rich but shows signs of maintainability strain: core modules are distributed as minified build artifacts in `lib/`, the README states SingleFileZ has been merged into its parent project SingleFile (suggesting this repo is superseded), and it relies on Manifest v2 which is being phased out by browsers. The custom polyfills and browser-specific workarounds add complexity. Despite this, several components (YABSON serialization, the ZIP library, cloud upload abstractions) are well-isolated and could be reused independently with minimal modification.
The LLM identified 3 files worth highlighting for reuse:
An extensible, async stream-based binary serialization library. It supports registering custom types, handles nested objects, and produces compact byte sequences. This module is fully self-contained with no internal project dependencies, making it reusable for any application needing efficient binary data transfer between contexts (e.g., between extension background and content scripts). It demonstrates skill in designing a general-purpose serialization protocol with type safety and streaming.
A complete, self-contained ZIP read/write library supporting various archive sources (Blob, HTTP, Data URI, split ZIP), compression (deflate/inflate), and encryption (AES-256, ZipCrypto). It includes a worker-based deflate implementation. The library is isolated and can be extracted for use in non-browser environments (Node.js, Service Workers). It demonstrates advanced handling of binary file formats and streaming I/O.
A fork of Mozilla's Readability.js algorithm for extracting article content from web pages. This module is standalone (only depends on browser DOM APIs) and can be reused in any JavaScript project that needs to convert a web page into a clean, readable article format. It represents a well-known, battle-tested library with sophisticated DOM scoring and cleaning logic.