Commands • API Reference • Browser Usage • File Types
Convert files to Markdown format. Supports Office documents, PDFs, code files, and archives.
npm install -g filetomarkdown
# 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
const { convertToMarkdown } = require('filetomarkdown');
// Convert to string
const markdown = await convertToMarkdown('document.pdf');
// Convert to file
await convertToMarkdown('document.pdf', 'output.md');
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');
<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>
After installation, you get these commands:
filetomarkdown
- Convert files to markdownfiletomarkdown-server
- Start API server on port 3000filetomarkdown-test
- Run conversion tests with example filesfiletomarkdown-filetypes
- List all supported file formatsfiletomarkdown-viewer
- Download and launch standalone Markdown Viewer
- ✅ 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
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
- 🎯 Features: File browser, live preview, syntax highlighting, and editing capabilities
- 💻 Platform: Windows executable (no installation required)
- 🔗 Repository: 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!
filetomarkdown report.pdf report.md
filetomarkdown presentation.docx presentation.md
filetomarkdown archive.zip
# Creates markdown files for each supported file in the archive
filetomarkdown-server
# Server runs on http://localhost:3000
# API endpoints: /api/convert, /api/filetypes, /health
MIT