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 🙏

© 2025 – Pkg Stats / Ryan Hefner

down-craft

v0.1.2

Published

Convert various document types (PDF, DOCX, PPTX, XLSX) to Markdown format

Downloads

27

Readme

📑 Down Craft

Node.js package to simplify the process of converting documents (PDF, DOCX, PPTX, and XLSX) into Markdown format. It uses tesseract.js, mammoth, pdf.js, and turndown to convert documents to Markdown format. For PDFs, it also provides an option to use vLLMs (Vision Large Language Models) for advanced OCR capabilities (using the OpenAI API).

down-craft

Online Web Demo

https://down-craft.dyndns.org/

Installation

npm install down-craft

Usage

import { downCraft } from 'down-craft';
import fs from 'fs/promises';

async function example() {
  // Read file buffer
  const fileBuffer = await fs.readFile('document.docx');
  
  // Convert to markdown (pass file buffer and file type)
  const markdown = await downCraft(fileBuffer, 'docx');
  
  console.log(markdown);
}

Supported File Types

  • PDF (.pdf)
  • Microsoft Word (.docx)
  • Microsoft PowerPoint (.pptx)
  • Microsoft Excel (.xlsx)

API

downCraft(fileBuffer, fileType?, options?)

Converts a document buffer to markdown format.

  • fileBuffer (Buffer): The document buffer to convert
  • fileType (string, optional): File type ('pdf', 'docx', 'pptx', 'xlsx'). If not provided the file type will be attempted to be auto-detected.
  • options (Object, optional): Conversion options
    • pdfConverterType (string, optional): Converter to use for PDF files ('standard' | 'llm' | 'ocr'). Default: 'standard'
    • llmParams (Object, required for 'llm' converter): LLM configuration
      • baseURL (string): Base URL for the LLM API
      • apiKey (string): API key for the LLM service
      • model (string): Model to use for OCR

Returns: Promise - The markdown content

PDF Conversions

  • Standard: Extracts text using standard techniques (images are ignored).
  • vLLM: Uses a vLLM-based OCR model to extract text from PDFs (high fidelity, but much slower and requires an LLM API endpoint).
  • OCR: Uses Tesseract.js for OCR (results are less accurate, but faster than using vLLM).

Special Features

vLLM-based PDF Conversion

For PDFs that require advanced OCR capabilities, you can use the vLLM converter:

const markdown = await downCraft(pdfBuffer, 'pdf', {
  pdfConverterType: 'llm',
  llmParams: {
    baseURL: 'https://api.llm-service.com',
    apiKey: 'your-api-key',
    model: 'your-model-name'
  }
});

This converter:

  • Extracts embedded images from the PDF
  • Converts PDF pages to high-quality images
  • Uses vLLM-based OCR for accurate text extraction
  • Automatically cleans up temporary files

The llmParams object will attempt to read environment variables for baseURL, apiKey, and model if you have them defined. See the .env.example file for an example (it also shows an example of how you can define your own user/system prompts), as well as various LLM providers / models.

License

This package is licensed under the Apache 2.0 license.
See LICENSE for details.