Registry / devops / file-bundler

file-bundler

JSON →
library2.2.0jsnpmunverified

File-bundler is a CLI and library tool that bundles multiple files into a single file for easy distribution and sharing. It supports any file format and provides a simple API for programmatic use. The current stable version is 2.2.0, with a low release cadence. Unlike other bundlers, it targets general file aggregation rather than JavaScript module bundling, making it suitable for packaging assets, configuration files, or documentation.

npm install file-bundler
INSTALL
IMPORT
SIG · FILE-BUNDLER
F
file-bundler
devopsjavascriptv2.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import fileBundler from 'file-bundler'
const fileBundler = require('file-bundler')
ESM-only since v2.0.0; use default import.
bundle
import { bundle } from 'file-bundler'
import { bundle } from 'file-bundler/bundle'
Named export 'bundle' directly from main package; path subimport is incorrect.
FileBundler
import { FileBundler } from 'file-bundler'
import { FileBundler } from 'file-bundler'
Type-safe; TypeScript types included.

Shows basic usage: bundling multiple files into one output with the bundle function.

import { bundle } from 'file-bundler'; async function main() { const result = await bundle({ files: ['src/file1.txt', 'src/file2.txt'], output: './bundle.txt' }); console.log('Bundled successfully:', result.path); } main().catch(console.error);
Debug
Known issues
breakingIn v2.0.0, the API changed from synchronous to asynchronous (promise-based).
fix
Use async/await or promises instead of synchronous calls.
affects: >=2.0.0
breakingIn v2.0.0, CommonJS require() no longer works; ESM imports are required.
fix
Use import syntax or set 'type': 'module' in package.json.
affects: >=2.0.0
deprecatedThe 'FileBundler' class (constructor) is deprecated; use the 'bundle' function instead.
fix
Replace 'new FileBundler().bundle(...)' with 'bundle(...)'.
affects: >=2.0.0
gotchaEmpty file list throws an error without a clear message.
fix
Check files array length before calling bundle.
affects: all
gotchaOutput directory must exist; it will not be created automatically.
fix
Ensure the output directory exists before bundling.
affects: all
gotchaLarge files (over 500MB) may cause memory issues as the bundle is held in memory.
fix
Stream files individually or use alternative tools for large files.
affects: all
Errors
Common errors & fixes
TypeError: fileBundler is not a function
Using CommonJS require() which returns the default export as an object, not a function.
fix
Use import fileBundler from 'file-bundler' or use the named import { bundle }.
Error: Cannot find module 'file-bundler'
Package not installed or missing from node_modules.
fix
Run npm install file-bundler in your project.
Error: ENOENT: no such file or directory, open 'output.txt'
Output directory does not exist.
fix
Create the output directory before bundling, e.g., mkdir -p ./dist.
TypeError: files is not iterable
files option not provided or is undefined.
fix
Pass a non-empty array of file paths as the 'files' option.
Upgrade
Version history
2.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources