npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aldrs/packager

v2.0.3

Published

A CLI tool to create a structured JSON and zip a directory with UTF-8 support, audio/video filtering, and cross-platform compatibility.

Downloads

18

Readme

@aldrs/packager

@aldrs/packager is a cross-platform CLI tool that analyzes a directory, generates a structured JSON representation of its contents, and creates ZIP archives accordingly. It supports advanced file filtering, intelligent ordering, and content segmentation based on user-defined size thresholds.

Version 2.0.0


Key Features

  • Structured JSON Generation
    Recursively scans the target directory and creates a directory_structure.json file that describes each node with the following properties:

    • name: The display name (with numeric prefixes removed if present).
    • order: A numeric order extracted from any numeric prefix; for items without a prefix, a sequential number is assigned using Arabic-aware sorting at each directory level.
    • oldName: The original name of the file or folder.
    • path: The relative path from the package root.
    • type: One of file, folder, or attachments.
    • subFolderAndfiles: An array representing nested subdirectories and their contents.
  • File Filtering & Validation

    • Only allowed audio and video files (determined by MIME types) are included.
    • Recognizes and includes attachments (e.g. PDF, DOC, DOCX, EPUB) as extra metadata.
    • Optionally enforces a “leaf-only” rule where only leaf directories may contain files.
    • Analyzes directories to distinguish between valid “subjects” (directories with audio/video files) and “categories” (nested structures containing subjects).
  • Content Segmentation
    Automatically splits the package into multiple ZIP archives if the total size of files exceeds a user-specified maximum:

    • User-Defined Size Threshold: Must be between 50 MB and 1000 MB.
    • Segmentation Logic: Files are distributed across segments (while preserving directory structure) so that no single ZIP file exceeds the specified limit.
    • Validation: If any single file exceeds the maximum allowed size, the command fails.
  • CLI & Interactive Modes

    • Interactive Mode:
      Running the command without arguments launches an interactive menu where the user can choose options such as processing mode, maximum ZIP size, target category, and root category order.
    • CLI Mode:
      Providing command-line arguments runs the tool non-interactively.
      Options:
      • -m, --mode <subjects|categories>: Processing mode (default: subjects).
      • -z, --maxZipSize <number>: Maximum overall ZIP file size in MB (must be between 50 and 1000). If the total file size exceeds this limit, segmentation is applied. If any single file exceeds this limit, the command fails.
      • -t, --targetCategory <string>: (Optional) Target category for upload.
      • -r, --rootCategoryOrder <string>: (Optional) Root category order value.
      • -h, --help: Display help information.
  • Cross-Platform Compatibility
    Built on Node.js (>=18.0.0), @aldrs/packager works seamlessly on Windows, macOS, and Linux.


Installation

Install globally via npm:

npm install -g @aldrs/packager

This makes the aldrs-pack command available globally.


Usage

Interactive Mode (Default)

Run the command without arguments to launch the interactive menu:

aldrs-pack

In interactive mode, you will be prompted to choose the processing mode, specify the maximum ZIP size (between 50 MB and 1000 MB), and optionally set a target category and root order.

CLI Mode

You can also run the tool in CLI mode by providing command-line options:

aldrs-pack [options] [directory]

If [directory] is omitted, the current working directory is used.

Options

  • -m, --mode <subjects|categories>
    Processing mode. Default is subjects.

  • -z, --maxZipSize <number>
    Maximum overall ZIP file size in MB (must be between 50 and 1000).
    If the total file size exceeds this limit, the tool segments the content into multiple ZIP archives. If any single file exceeds this limit, the command fails.

  • -t, --targetCategory <string>
    (Optional) Target category for upload.

  • -r, --rootCategoryOrder <string>
    (Optional) Root category order value.

  • -h, --help
    Display help information.

Examples

  • Run in CLI Mode on a Specific Directory in Subjects Mode:

    aldrs-pack --mode subjects --maxZipSize 800 /path/to/directory
  • Run in CLI Mode in Categories Mode with Default Size:

    aldrs-pack --mode categories /path/to/directory

Build and Test

  • Build:
    Compile TypeScript to JavaScript:

    npm run build
  • Test:
    Run the integration test suite using:

    npm run test

    The tests cover ordering, segmentation, attachment inclusion, CLI/interactive mode consistency, and validation of maxZipSize.


License

This project is licensed under the MIT License.