# filetomarkdown

> Convert various file types to markdown format with browser and Node.js support

Latest version **0.6.9** (published 2025-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install filetomarkdown
pnpm add filetomarkdown
yarn add filetomarkdown
bun add filetomarkdown
```

Provides the commands `filetomarkdown`, `filetomarkdown-test`, `filetomarkdown-server`, `filetomarkdown-viewer`, `filetomarkdown-filetypes`.

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.9 |
| Published | 2025-08-09 |
| First published | 2024-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 10 |
| Unpacked size | 5.5 MB |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Josef |
| Maintainers | jojomondag |
| Keywords | markdown, converter, browser, node, pdf, docx, webpack, typescript, types |

## Links

- npm: https://www.npmjs.com/package/filetomarkdown
- Repository: https://github.com/jojomondag/FileToMarkdown
- Issues: https://github.com/jojomondag/FileToMarkdown/issues
- npm.io page: https://npm.io/package/filetomarkdown

## Dependencies (10)

- [cors](https://npm.io/package/cors.md) ^2.8.5
- [multer](https://npm.io/package/multer.md) ^2.0.1
- [xml2js](https://npm.io/package/xml2js.md) ^0.6.2
- [adm-zip](https://npm.io/package/adm-zip.md) ^0.5.16
- [express](https://npm.io/package/express.md) ^5.1.0
- [mammoth](https://npm.io/package/mammoth.md) ^1.9.1
- [prismjs](https://npm.io/package/prismjs.md) ^1.30.0
- [7zip-min](https://npm.io/package/7zip-min.md) ^2.1.0
- [pdf-parse](https://npm.io/package/pdf-parse.md) ^1.1.1
- [xlsx-js-style](https://npm.io/package/xlsx-js-style.md) ^1.2.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.6.9 (latest) — 2025-08-09
- 0.6.8 — 2025-08-02
- 0.6.7 — 2025-06-22
- 0.6.6 — 2025-06-22
- 0.6.5 — 2025-06-22
- 0.6.4 — 2025-06-20
- 0.6.3 — 2025-06-20
- 0.6.2 — 2025-06-20
- 0.6.1 — 2025-06-20
- 0.6.0 — 2025-06-20
- 0.5.1 — 2025-06-18
- 0.5.0 — 2025-06-15
- 0.4.18 — 2025-04-06
- 0.4.16 — 2025-04-03
- 0.4.15 — 2025-04-03
- … 115 more at https://npm.io/package/filetomarkdown/versions

## README

**[Commands](docs/COMMANDS.md)** • **[API Reference](docs/API.md)** • **[Browser Usage](docs/BROWSER.md)** • **[File Types](docs/CONVERTERS.md)**
# FileToMarkdown

Convert files to Markdown format. Supports Office documents, PDFs, code files, and archives.

## Quick Start

### Install
```bash
npm install -g filetomarkdown
```

## Usage

### Command Line
```bash
# Test conversions with example files
filetomarkdown-test

# Convert single file
filetomarkdown input.docx output.md

# Start API server
filetomarkdown-server

# List supported file types
filetomarkdown-filetypes

# Download and launch Markdown Viewer (auto-installs)
filetomarkdown-viewer
```

### Node.js API

#### JavaScript
```javascript
const { convertToMarkdown } = require('filetomarkdown');

// Convert to string
const markdown = await convertToMarkdown('document.pdf');

// Convert to file
await convertToMarkdown('document.pdf', 'output.md');
```

#### TypeScript
```typescript
import { MarkitDown, convertToMarkdown } from 'filetomarkdown';

// Using the class with options
const converter = new MarkitDown({ collapsible: true });
const markdown = await converter.convertToMarkdown('document.pdf');

// Using the convenience function
const result = await convertToMarkdown('document.pdf', 'output.md');
```

### Browser (API Client)
```html
<script src="https://unpkg.com/filetomarkdown"></script>
<script>
  // Create client instance (requires filetomarkdown-server running)
  const client = new FileToMarkdown.FileToMarkdownClient();
  client.baseURL = 'http://localhost:3000';
  
  // Convert file via API
  client.convertFile(file).then(result => {
    console.log(result.markdown);
  });
</script>
```



## Available Commands

After installation, you get these commands:

- **`filetomarkdown`** - Convert files to markdown
- **`filetomarkdown-server`** - Start API server on port 3000  
- **`filetomarkdown-test`** - Run conversion tests with example files
- **`filetomarkdown-filetypes`** - List all supported file formats
- **`filetomarkdown-viewer`** - Download and launch standalone Markdown Viewer

## Features

- ✅ Preserves formatting (tables, lists, headings)
- ✅ Syntax highlighting for code
- ✅ Archive extraction and conversion
- ✅ CLI and API support
- ✅ Browser compatible
- ✅ TypeScript support
- ✅ 60+ file formats supported

## Markdown Viewer

For viewing and editing the converted markdown files, use our standalone **Markdown Viewer** application:

- 🚀 **Quick Install & Launch**: `filetomarkdown-viewer` (auto-downloads and runs)
- 📱 **Manual Download**: [Download Latest Release](https://github.com/jojomondag/Markdown-Viewer/releases/latest)
- 🎯 **Features**: File browser, live preview, syntax highlighting, and editing capabilities
- 💻 **Platform**: Windows executable (no installation required)
- 🔗 **Repository**: [Markdown-Viewer](https://github.com/jojomondag/Markdown-Viewer)
- 🔄 **Auto-updates**: The viewer command automatically downloads the latest version

**Easiest way**: Just run `filetomarkdown-viewer` after installing the package - it installs and launches automatically!

## Examples

### PDF → Markdown
```bash
filetomarkdown report.pdf report.md
```

### Word Document → Markdown
```bash
filetomarkdown presentation.docx presentation.md
```

### ZIP Archive → Multiple Files
```bash
filetomarkdown archive.zip
# Creates markdown files for each supported file in the archive
```

### Start API Server
```bash
filetomarkdown-server
# Server runs on http://localhost:3000
# API endpoints: /api/convert, /api/filetypes, /health
```

## License

MIT

---
_Source: https://npm.io/package/filetomarkdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
