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

claude-docx-generator

v1.0.0

Published

Turn JavaScript that builds a docx Document into a real .docx file — without editing file paths. Paste AI-generated docx code and run.

Readme

DOCX Generator — Paste & Produce

Platform: Node.js Type: Local Tool Outputs: outputs/

Turn JavaScript that builds a docx Document into a real .docx file — without editing file paths.

Why this Exists:

Scenario: Claude Timed Out, But the DOCX Still Needs to Exist

You're working with an AI assistant to generate a 40-page report, proposal, thesis draft, or technical document.

The AI successfully writes the JavaScript that builds the DOCX using the docx package:

const { Document, Packer, Paragraph } = require("docx");
// hundreds of lines of generated content...

But then one of these things happens:

  • The AI session times out before producing the actual .docx file.
  • The generated script contains an environment-specific path such as /mnt/data/report.docx.
  • The code came from Claude, ChatGPT, Gemini, or another platform that saved files to a location that doesn't exist on your machine.
  • You just want the document now—not another round of path fixing and debugging.

Instead of editing file paths throughout the script, you paste the generated code into paste_here.js and run:

node paste_here.js

This tool automatically intercepts the DOCX file write operation and redirects the output into the local outputs/ directory.

The result: AI-generated DOCX code becomes a real .docx file on your computer in seconds, regardless of where the original script expected to save it.

In short: when an AI can generate the document code but cannot deliver the document itself, this repository bridges the gap.

Badges & quick facts

  • No publish required: this is a local tool — run with Node.js.
  • Safe outputs: outputs/ is in .gitignore so generated DOCX files won't be committed accidentally.

Quick start

  1. Install dependencies:
npm install
  1. Paste your docx-generating code into paste_here.js. paste_here.js already requires runner.js which redirects Buffer writes into outputs/.

  2. Run:

node paste_here.js
# or
npm run paste

File references

How it works (brief)

  • Many docx scripts follow the pattern:
Packer.toBuffer(doc).then(buffer => fs.writeFileSync('/some/absolute/path/my.docx', buffer));
  • runner.js monkey-patches fs.writeFileSync and fs.writeFile at runtime. When the patched functions detect a Buffer (the docx payload), they replace the destination path with outputs/<basename> so you don't have to edit the original code.

Best practices

  • Keep outputs/ small — it contains generated binary files and is git-ignored.
  • If your pasted script writes streams, custom promises, or uses other FS APIs, open an issue or ask me to extend runner.js to catch that pattern.

Examples

  • To test quickly, run the included example:
node generate2.js
  • The example will write MIT_Masterclass_Geometry_of_Meaning.docx into outputs/.

Contributing

  • This is a tiny local tool. If you want features such as a CLI argument for destination, stream interception, or previewing generated docx, tell me which feature and I will add it.

License

  • No license specified. Add a LICENSE file if you want to open-source this project.