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

files-to-prompt

v0.1.1

Published

Convert files to a format suitable for LLM prompting

Downloads

25

Readme

files-to-prompt

A Node.js tool to convert files to a format suitable for LLM prompting.

This is a JavaScript implementation of Simon Willison's files-to-prompt tool, designed to prepare file contents for use in prompts to language models like GPT-4.

Installation

npm install -g files-to-prompt

Or use without installation:

npx files-to-prompt [options]

Usage

files-to-prompt [options]

Options

-d, --directory <path>     directory to scan (default: current directory)
-o, --output <file>        output file (default: stdout)
-f, --format <format>      output format: json or markdown (default: markdown)
-i, --include <patterns>   comma-separated glob patterns to include (default: **)
-e, --exclude <patterns>   comma-separated glob patterns to exclude 
                           (default: node_modules/**,**/.git/**)
-m, --max-size <size>      maximum file size in KB to include (default: 100)
-l, --max-length <length>  maximum content length in characters (default: 1000000)
-s, --summary              include only file paths without content
-c, --no-color             disable colored output
-p, --prefix <text>        text to prefix each file with (default: "File:")
-v, --verbose              verbose output
-h, --help                 display help for command
-V, --version              output the version number

Examples

Scan the current directory and output all files in Markdown format:

files-to-prompt

Scan a specific directory and save to a file:

files-to-prompt --directory ./my-project --output prompt.md

Include only JavaScript files:

files-to-prompt --include "**/*.js"

Exclude test files:

files-to-prompt --exclude "**/*.test.js,**/*.spec.js"

Output as JSON:

files-to-prompt --format json

Generate a summary of files without their contents:

files-to-prompt --summary

Programmatic Usage

const { scanFiles, formatOutput, writeOutput } = require('files-to-prompt');

async function generatePrompt() {
  const files = await scanFiles({
    directory: './my-project',
    includePatterns: ['**/*.js'],
    excludePatterns: ['node_modules/**', '**/.git/**'],
    maxSize: 102400, // 100KB
    maxLength: 1000000,
    summary: false,
    verbose: false
  });
  
  const output = formatOutput(files, {
    format: 'markdown',
    prefix: 'File:',
    summary: false
  });
  
  // Write to file
  await writeOutput(output, 'prompt.md');
  
  // Or use the output directly
  console.log(output);
}

generatePrompt();

License

MIT

Credits

Based on the Python tool files-to-prompt by Simon Willison.