Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
file-combination-tool
Advanced tools
The File Combination Tool is a Node.js script that combines multiple files from a specified directory (and its subdirectories) or a GitHub repository folder into a single output file. It supports various programming languages and file types, providing options to include or exclude specific files or directories, remove header comments, and output statistics about the largest files and folders processed.
You can use this tool without installation via npx, or you can install it globally on your system.
No installation required. Simply run the tool using npx:
npx file-combination-tool [options]
To install the tool globally, run:
npm install -g file-combination-tool
Then you can use it from anywhere:
file-combination-tool [options]
If you want to clone the repository and run it locally:
Clone the repository:
git clone https://github.com/your-username/file-combination-tool.git
cd file-combination-tool
Install dependencies:
npm install
Run the tool:
node cli.js [options]
To combine all supported files in the current directory:
npx file-combination-tool
This will create a file named combined_[current-directory-name].txt
in the current directory.
To combine files from a GitHub repository:
npx file-combination-tool --githubUrl https://github.com/username/repo/tree/branch/path/to/folder --githubToken YOUR_GITHUB_TOKEN
Replace YOUR_GITHUB_TOKEN
with a valid GitHub Personal Access Token.
The token is optional, but you do run the risk of running into rate limits without it.
npx file-combination-tool [options]
Options (all are optional):
--baseDir
, -b
: Base directory to process files from (default: current directory)--githubUrl
, -g
: GitHub URL to process files from--githubToken
, -t
: GitHub Personal Access Token for authentication--include
, -i
: Files or folders to include (comma-separated)--exclude
, -e
: Patterns to exclude (comma-separated, default: 'node_modules/,venv/,.git/')--extensions
, -x
: File extensions to process (comma-separated, default: .js,.ts,.jsx,.tsx,.py,.rb,.java,.c,.cpp,.cs,.php,.go,.rs,.swift,.kt,.md)--output
, -o
: Output file name (default: combined_[baseDir-name].txt)--config
, -c
: Path to config file (if using a config file instead of command-line args)Examples:
Combine Python files:
npx file-combination-tool --extensions .py
Combine Java and Kotlin files:
npx file-combination-tool --extensions .java,.kt
Exclude additional patterns:
npx file-combination-tool --exclude "test/,*.spec.js"
Specify output file:
npx file-combination-tool --output combined-project.txt
Combine files from a different directory:
npx file-combination-tool --baseDir ../another-project
For more complex scenarios, you can use a config file:
npx file-combination-tool --config path/to/your/config.json
Config file structure:
{
"baseDir": "/path/to/your/base/directory",
"githubUrl": "https://github.com/username/repo/tree/branch/path/to/folder",
"githubToken": "YOUR_GITHUB_TOKEN",
"include": ["folder1", "folder2/file.py"],
"exclude": ["test/", "*.spec.py"],
"extensions": [".py", ".pyx"],
"output": "combined_output.txt",
"headerPatterns": [
"#.*",
"'''[\\s\\S]*?'''",
'"""[\\s\\S]*?"""'
]
}
The tool supports the following file extensions by default: .js, .ts, .jsx, .tsx, .py, .rb, .java, .c, .cpp, .cs, .php, .go, .rs, .swift, .kt, .md
You can specify additional file extensions using the --extensions
option or in the config file.
The script will generate:
Contributions to improve the tool are welcome. Please feel free to submit issues or pull requests on the project's repository.
MIT License
FAQs
A tool to combine multiple files from a specific directory
The npm package file-combination-tool receives a total of 7 weekly downloads. As such, file-combination-tool popularity was classified as not popular.
We found that file-combination-tool demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.