功能强大的在线文件格式转换工具
支持 40+ 种格式互转,包括文档、图像、音频、视频、数据格式

功能特性 · 快速开始 · 贡献指南
FileConverter 是一个现代化的文件格式转换平台,采用前后端分离架构,支持单文件和批量转换两种模式。文档转换由 Gotenberg(LibreOffice 引擎)驱动,图像和数据转换在浏览器本地完成,保护用户隐私。
| 特性 |
描述 |
| 🚀 边缘加速 |
基于 Cloudflare Pages 全球部署,就近访问 |
| 🔒 隐私优先 |
图像、数据、音视频转换在浏览器本地完成,文件不离开设备 |
| 🆓 完全免费 |
无需注册,无广告,无使用限制 |
| 📱 响应式设计 |
完美适配移动端和桌面端 |
| 🎨 现代化 UI |
毛玻璃效果、渐变色、流畅动画、深色模式 |
| ⚡ 批量处理 |
支持多文件并行转换,独立选择目标格式 |
| 👁️ 实时预览 |
转换完成后可直接预览 PDF、HTML、图像等格式 |
| 源格式 |
可转换为 |
转换引擎 |
| PDF |
DOCX, XLSX, PPTX, TXT, HTML |
Adobe API / pdfjs |
| DOCX |
PDF, TXT, HTML, MD |
Gotenberg / mammoth |
| DOC |
PDF, DOCX, TXT, HTML |
Gotenberg |
| ODT / RTF |
PDF, TXT, HTML |
Gotenberg |
| XLSX / XLS / ODS |
PDF, CSV, HTML |
Gotenberg / SheetJS |
| PPTX / PPT / ODP |
PDF, TXT |
Gotenberg |
| VSD / VSDX |
PDF |
Gotenberg |
| Markdown |
PDF, DOCX, HTML, TXT |
Gotenberg / docx |
| TXT / HTML |
PDF, DOCX, MD |
Gotenberg |
| 源格式 |
可转换为 |
转换引擎 |
| JPG / JPEG |
PNG, WebP, GIF, BMP, ICO, TIFF |
Canvas API |
| PNG |
JPG, WebP, GIF, BMP, ICO, TIFF |
Canvas API |
| WebP |
JPG, PNG, GIF, BMP, TIFF |
Canvas API |
| GIF |
JPG, PNG, WebP, BMP |
Canvas API |
| BMP |
JPG, PNG, WebP, GIF, ICO |
Canvas API |
| ICO |
JPG, PNG, WebP, BMP |
Canvas API |
| SVG |
PNG, JPG, WebP |
Canvas API |
| TIFF |
JPG, PNG, WebP, GIF, BMP |
Canvas API |
| 源格式 |
可转换为 |
转换引擎 |
| MP3 / WAV / OGG / FLAC / AAC / M4A |
互转 |
FFmpeg.wasm |
| 源格式 |
可转换为 |
转换引擎 |
| MP4 / WebM / AVI / MOV / MKV |
互转 |
FFmpeg.wasm |
| 源格式 |
可转换为 |
转换引擎 |
| JSON |
XML, CSV, YAML, TOML |
纯 JS |
| XML |
JSON, CSV, YAML |
纯 JS |
| CSV |
XLSX, JSON, XML |
SheetJS / 纯 JS |
| YAML |
JSON, XML, CSV, TOML |
纯 JS |
| TOML |
JSON, YAML, CSV |
纯 JS |
- Node.js >= 18.x
- npm >= 9.x
# 克隆项目
git clone https://github.com/yourusername/fileconverter.git
cd fileconverter
# 安装依赖
npm install
# 启动前端开发服务器(仅前端,端口 5173)
npm run dev
# 启动完整开发环境(前端 + Cloudflare Functions,端口 8788)
npm run dev:full
# 构建生产版本
npm run build
# 预览构建结果
npm run preview
# 部署到 Cloudflare Pages
npm run deploy
fileconverter/
├── functions/ # Cloudflare Pages Functions
│ └── api/
│ ├── convert.ts # 通用转换 API
│ ├── doc-convert.ts # 文档转换 API
│ └── gotenberg-health.ts # Gotenberg 健康检查
├── src/
│ ├── components/ # React 组件
│ │ ├── converter/ # 转换器组件
│ │ │ ├── BatchConverter.tsx
│ │ │ └── ImageOptions.tsx
│ │ └── ui/ # UI 组件
│ │ ├── Button.tsx
│ │ ├── ConversionProgress.tsx
│ │ ├── FileUpload.tsx
│ │ ├── FormatSelector.tsx
│ │ ├── GotenbergStatus.tsx
│ │ └── ThemeToggle.tsx
│ ├── contexts/ # React Context
│ │ └── ThemeContext.tsx
│ ├── lib/ # 核心库
│ │ ├── converters/ # 转换器模块
│ │ │ ├── index.ts # 统一入口
│ │ │ ├── imageConverter.ts
│ │ │ ├── dataConverter.ts
│ │ │ ├── docConvertConverter.ts
│ │ │ ├── docxParser.ts
│ │ │ ├── mdToDocxConverter.ts
│ │ │ └── types.ts
│ │ └── utils.ts
│ ├── types/ # TypeScript 类型定义
│ │ └── index.ts
│ ├── App.tsx # 主应用组件
│ ├── index.css # 全局样式
│ └── main.tsx # 应用入口
├── public/ # 静态资源
├── package.json
├── tsconfig.json
├── vite.config.ts
├── wrangler.toml # Cloudflare 配置
└── LICENSE # MIT 许可证
1. 图像 (JPG/PNG/WebP/...) → Canvas API(浏览器本地)
2. 数据 (JSON/XML/CSV/...) → 纯 JS 解析(浏览器本地)
3. 音视频 (MP3/MP4/...) → FFmpeg.wasm(CDN 懒加载)
4. 表格 (XLSX/CSV) → SheetJS(浏览器本地)
5. 文档 (DOCX/PDF/...) → Gotenberg / Adobe API(后端)
import { convertFile, getConversionMethod } from '@/lib/converters'
// 转换文件
const result = await convertFile(file, 'docx', 'pdf', {
quality: 0.92
})
// 获取转换方式
const method = getConversionMethod('docx', 'pdf')
// 返回: 'gotenberg' | 'frontend' | 'adobe' | 'backend'
// 下载结果
const url = URL.createObjectURL(result.blob)
// result.filename: 输出文件名
// result.mimeType: MIME 类型
- ✅ 图像和数据转换在浏览器本地完成,不上传服务器
- ✅ 文件处理完成后立即释放内存
- ✅ 输入验证和格式检查
- ✅ 控制字符清理,防止注入攻击
- ✅ 敏感配置通过环境变量管理
欢迎参与项目贡献!请遵循以下步骤:
- 使用清晰的标题描述问题
- 提供复现步骤和环境信息
- 添加适当的标签(bug / feature / documentation)
- Fork 本仓库
- 创建功能分支:
git checkout -b feature/amazing-feature
- 提交更改:
git commit -m 'feat: add amazing feature'
- 推送分支:
git push origin feature/amazing-feature
- 创建 Pull Request
- 遵循项目代码规范
- 使用 ESLint 进行代码检查:
npm run lint
- 保持 TypeScript 类型完整
- 添加必要的注释和文档
遵循 Conventional Commits 规范:
feat: 新功能
fix: 修复 bug
docs: 文档更新
style: 代码格式调整
refactor: 代码重构
test: 测试相关
chore: 构建/工具相关
本项目基于 MIT License 开源协议发布。
MIT License
Copyright (c) 2025 FileConverter Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
⬆ 返回顶部
Made with ❤️ by FileConverter Team