Skip to content

KelvinFelix/document-handler-cli

Repository files navigation

Document Handler CLI

A powerful command-line utility for automating document processing workflows. This tool enables you to merge multiple documents into a single consolidated file. Perfect for combining reports, articles, or any collection of documents that need to be shared as one cohesive document.

Currently, Document Handler CLI supports PDF files exclusively, with plans to expand support for additional formats including TXT, CSV, HTML, and other document types in future releases.

Getting Started

Prerequisites

  • Node.js version 18.0 or higher
  • npm package manager

Installation

  1. Clone the repository or download the source code
  2. Install dependencies:
npm install
  1. Build the application:
npm run build

Usage

Run the merge-documents command with your input files, output file, and working directory:

npm run merge-documents -- -i TheHollowMen.pdf SatoshiPaper.pdf TheRed-HeadedLeague.pdf -o AnnualReading.pdf -w ./workdir

Command Options

  • -i, --input <files...> - List of PDF files to merge (space-separated)
  • -o, --output <file> - Name of the merged output file
  • -w, --working-directory <path> - Directory containing input files and where output will be saved

Examples

Basic usage:

npm run merge-documents -- -i report1.pdf report2.pdf -o annual-report.pdf -w ./documents

Multiple files:

npm run merge-documents -- -i chapter1.pdf chapter2.pdf chapter3.pdf appendix.pdf -o complete-book.pdf -w ./book-files

Using absolute paths:

npm run merge-documents -- -i doc1.pdf doc2.pdf -o combined.pdf -w /home/user/documents

Sample Files

This project includes sample PDF files in the workdir folder for testing. You can specify any directory path for the -w argument as long as you have read/write permissions.

Notes

  • All input files must be valid PDF documents
  • The output file will be created in the specified working directory
  • If the output file already exists, it will be overwritten

Testing

This project includes comprehensive test coverage with both unit and integration tests to ensure reliability and maintainability.

Test Types

  • Unit Tests: Test individual components and functions in isolation
  • Integration Tests: Test CLI argument parsing and end-to-end workflows
  • Coverage Reports: Track code coverage across the entire codebase

Running Tests

Run all tests:

npm run test

Run tests with coverage report:

npm run test:coverage

Run integration tests only:

npm run test:integration

Author

About

Automation utility for handling and processing documents

Resources

Stars

Watchers

Forks

Packages

No packages published