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.
- Node.js version 18.0 or higher
- npm package manager
- Clone the repository or download the source code
- Install dependencies:
npm install- Build the application:
npm run buildRun 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-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
Basic usage:
npm run merge-documents -- -i report1.pdf report2.pdf -o annual-report.pdf -w ./documentsMultiple files:
npm run merge-documents -- -i chapter1.pdf chapter2.pdf chapter3.pdf appendix.pdf -o complete-book.pdf -w ./book-filesUsing absolute paths:
npm run merge-documents -- -i doc1.pdf doc2.pdf -o combined.pdf -w /home/user/documentsThis 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.
- 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
This project includes comprehensive test coverage with both unit and integration tests to ensure reliability and maintainability.
- 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
Run all tests:
npm run testRun tests with coverage report:
npm run test:coverageRun integration tests only:
npm run test:integration