npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

byteweaver

v1.1.6

Published

A powerful utility to weave files together with advanced filtering, minification and templating

Readme

ByteWeaver 🧵

A powerful command-line utility to weave files together with advanced filtering, minification and templating capabilities.

🚀 Installation

Install globally:

npm install -g byteweaver

Or locally in your project:

npm install --save-dev byteweaver

💻 Usage

byteweaver [options] <directory-path> <output-file>

Or use the shorter alias:

bw [options] <directory-path> <output-file>

Options

  • -r, --recursive - Search recursively through subdirectories
  • -e, --exclude <pattern> - Files to exclude (comma separated, can use *.ext for extensions)
  • -i, --include <pattern> - Files to include (comma separated, can use *.ext for extensions)
  • -m, --minify - Minify the output content (remove comments and excessive whitespace)
  • -t, --template <file> - Use a template file for the output
  • -d, --debug - Show detailed debug information during processing
  • --header <text> - Add header text at the beginning of the output file
  • --footer <text> - Add footer text at the end of the output file
  • --image-mode <mode> - Image processing mode: "base64-html", "base64-markdown", or "none"
  • -v, --version - Show version information
  • -h, --help - Show help message
  • .bwignore - File in the working directory to specify patterns to exclude (similar to .gitignore)

.bwignore

ByteWeaver supports a .bwignore file to exclude files and directories, similar to .gitignore. Place a .bwignore file in the directory where you run the command. Each line specifies a pattern to exclude. Lines starting with # are comments, and empty lines are ignored.

Example .bwignore:

# Ignore node_modules directory
node_modules

# Ignore log files
*.log

# Ignore configuration files
.env
package.json
package-lock.json

When a .bwignore file is present, ByteWeaver automatically excludes the specified patterns in addition to any patterns provided via the -e option.

Examples

Basic usage:

byteweaver src output.js

Using the shorter alias:

bw src output.js

Recursively search through directories:

bw -r src output.js

Include only JavaScript files:

bw -i "*.js" src output.js

Exclude specific files or patterns:

bw -e "node_modules,*.json" src output.js

Use .bwignore to exclude files:

bw -r src output.js

With a .bwignore file containing:

node_modules
*.log
.env

Minify the output:

bw -m src output.min.js

Use a template file:

bw -t template.txt src output.js

Enable debug mode:

bw -d src output.js

Add header and footer text:

bw --header="/* Copyright 2025 */" --footer="// End of file" src output.js

Process images as base64 in HTML:

bw --image-mode="base64-html" images output.html

Combine options with .bwignore:

bw -r -i "*.js,*.ts" -e "test,*.md" -m -d src output.min.js

With a .bwignore file excluding node_modules and *.json.

Important note for zsh users: When using wildcards in exclude patterns, make sure to quote the patterns to prevent shell expansion:

bw -r -e "*.jpg,*.png,node_modules" src output.txt

Combined flags are supported:

bw -rmi "*.ts" src output.js  # Equivalent to -r -m -i "*.ts"
bw -rmd src output.js         # Equivalent to -r -m -d

🔧 Programmatic API

ByteWeaver can also be used programmatically in your TypeScript or JavaScript applications:

import { concatenateFiles } from 'byteweaver';

concatenateFiles('./src', './output.js', { recursive: true })
  .then(result => console.log(`Processed ${result.fileCount} files`))
  .catch(error => console.error(error));

concatenateFiles('./src', './output.min.js', {
  recursive: true,
  include: ['*.js', '*.ts'],
  exclude: ['test', '*.spec.js', 'node_modules'],
  minify: true,
  outputTemplate: './template.txt',
  debug: true,
  header: '/* Copyright 2025 */',
  footer: '// End of file',
  imageMode: 'base64-html'
})
  .then(result => console.log(`Success: ${result.success}, Files: ${result.fileCount}`))
  .catch(error => console.error(error));

🔨 Development

This project is built with TypeScript. To contribute:

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Make your changes in the src directory
  2. Build the project:
npm run build
  1. Test your changes:
npm run dev -- [options] <directory-path> <output-file>

✅ Features

  • Concatenate files from a specified directory
  • Optional recursive directory traversal
  • Include only specific file types or patterns
  • Exclude files by name, path, or extension pattern
  • Support for .bwignore file to exclude patterns (similar to .gitignore)
  • Minify output to reduce size
  • Use templates to customize the output format
  • Clean output with proper file separation and comments
  • Debug mode for detailed processing information
  • Add custom header and footer text to output files
  • Process images as base64 in HTML or Markdown format
  • Support for combined command-line flags
  • Fully typed with TypeScript for better developer experience

📄 Template Files

You can use a template file with the placeholder {{content}} to customize how the concatenated content is formatted. For example:

{{content}}

📦 License

MIT