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

@asafarim/md-exporter

v0.2.3

Published

Export files from a target folder into a single Markdown file

Readme

md-exporter

A cross-platform CLI tool that exports files from a target folder into a single Markdown file with per-file headers and fenced code blocks.

Installation

npm install -g @asafarim/md-exporter
# or
pnpm add -g @asafarim/md-exporter

Quick Start

After installation, you can use the CLI directly on your local machine to export any folder:

md-exporter D:\your\folder\path --filter all --out-dir ./exports

The tool runs locally on your machine and has full access to your file system. All file paths are resolved relative to your current working directory or as absolute paths.

Built-in Help

Use the built-in help command to see all available options:

# Show help
md-exporter --help

# Show version
md-exporter --version

The help command displays all available options with descriptions and examples.

Testing During Development

If you're developing or testing the package locally:

# Install globally from local package
cd D:\repos\npm-packages\packages\md-exporter
npm install -g .

# Or use npx without global install
npx . --help

# Or run directly
node dist/cli.js --help

# Or use npm link for development
npm link

Usage

md-exporter <targetPath> [options]

Options

  • --filter <all|tsx|css|md|json|glob> - File filter type (default: all)
  • --pattern <glob> - Glob pattern (required when filter=glob)
  • --exclude <csv> - Comma-separated directory exclusions (default: "node_modules,.git,dist")
  • --max-size <mb> - Maximum file size in MB (default: 5)
  • --follow-symlinks - Follow symbolic links (default: false)
  • --dry-run - Perform a dry run without writing output (default: false)
  • --verbose - Enable verbose logging (default: false)
  • --out-dir <path> - Output directory (default: current working directory)
  • --eol <lf|crlf> - End-of-line style (default: lf)
  • --report-json <path> - Write JSON metrics report to specified path
  • --no-prettier - Skip Prettier formatting

Examples

Export all TypeScript files from a folder

md-exporter ./src --filter tsx --out-dir ./exports

Export all JSON files from a folder

md-exporter ./src --filter json --out-dir ./exports

Export with custom glob pattern

md-exporter D:\my-project\src --filter glob --pattern "**/*.{ts,tsx,js}" --out-dir ./exports

Export with exclusions

md-exporter ./src --filter all --exclude "node_modules,.git,dist,build" --out-dir ./exports

Dry run (preview without writing)

md-exporter ./src --dry-run --verbose

Programmatic API

Use the library in your Node.js/TypeScript projects:

import { runExport } from '@asafarim/md-exporter';

const result = await runExport({
  targetPath: './src',
  filter: 'tsx',
  exclude: ['node_modules', '.git'],
  maxSize: 5,
  outDir: './exports',
  dryRun: false,
  verbose: true
});

console.log(result.report);

Important: Local vs. Server Usage

Local CLI (Recommended)

When you install and run md-exporter as a CLI tool, it runs directly on your machine with full access to your local file system. You can export any folder path:

# Windows
md-exporter D:\Users\YourName\Documents\MyProject\src

# macOS/Linux
md-exporter /Users/yourname/Documents/MyProject/src

Web Demo (Development Only)

The included React demo app with a Node.js server is for demonstration purposes only. It requires:

  1. The server running on your local machine
  2. The server having access to your local file system
  3. Both web UI and server running simultaneously

The demo is useful for testing and visualization, but for production use, use the CLI directly on your machine where you need to export files.

Output

The tool generates a Markdown file with:

  • Timestamp-based filename: YYYYMMDD_HHMMSS_{filter}.md
  • Per-file headers: file {absolute-path}:
  • Syntax-highlighted code blocks with language tags
  • Optional JSON report with metrics and timings

Publishing

This package is set up for automated publishing to NPM:

Local Version Bump & Publish

# Bump version and publish automatically
npm version patch  # or minor, major

This will:

  1. Build the package
  2. Update version in package.json
  3. Commit the version change
  4. Push to GitHub
  5. Publish to NPM

GitHub Actions

The package also uses GitHub Actions for automatic publishing when tags are pushed:

# Create and push a tag to trigger publishing
git tag v0.2.0
git push origin v0.2.0

Setup Required:

  • Add NPM_TOKEN to GitHub repository secrets
  • Ensure you have publish access to the @asafarim/md-exporter package