cross-zip-cli is a command-line interface wrapper for the `cross-zip` library, designed to provide consistent cross-platform directory zipping and unzipping capabilities. It exposes two main commands: `cross-zip` for compression and `cross-unzip` for decompression. This tool is particularly valuable for developers writing `npm` scripts or other automated build processes that need to function identically across Windows, macOS, and Linux environments, abstracting away the underlying operating system's native archiving utilities. The current stable version is 1.0.0, and it appears to be in a maintenance state with no recent updates since 2021. Its primary differentiator is its focus on simplifying cross-platform archival tasks within automated workflows, ensuring reliability and compatibility regardless of the host OS.
npm install cross-zip-cliVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `cross-zip-cli` and then use its `cross-zip` and `cross-unzip` commands within `npm` scripts to create a test directory, archive it, and then extract its contents, ensuring cross-platform compatibility.
Always install globally with `npm install -g cross-zip-cli` or use `npx cross-zip` (after a local `npm install cross-zip-cli`) to ensure commands are executable.
Quote any path arguments that contain spaces or special characters: `cross-zip "./path with spaces/input" "./path with spaces/output.zip"`.
Monitor the file system for changes (e.g., new zip file appearing, target directory growing) or run in a background process if non-blocking execution is required. Consider piping output to a log file for long operations.
Ensure your build scripts or manual commands check for the existence of the destination zip file (e.g., using `test -f file.zip || cross-zip ...`) or use temporary filenames to prevent accidental overwrites.
If installed locally, use `npx cross-zip` or run it from `$(npm bin)/cross-zip`. For global access, ensure it's installed globally with `npm install -g cross-zip-cli` and that your npm global bin directory is in your system's PATH.
Verify that the input directory path is correct and that the directory actually exists before running the `cross-zip` command.
Verify that the input zip file path is correct and that the file actually exists before running the `cross-unzip` command.
Change the output directory to one where the current user has write permissions, or adjust the file system permissions for the target directory.