@file-type/cfbf

中文文档
0.2.2发布于 2026/01/25MITTypeScriptES Module近 30 天下载 9.2万

Compound File Binary Format (CFBF) detection plugin for file-type

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Support file formats
  4. Microsoft Office legacy formats
  5. Licence

NPM version Node.js CI npm downloads

@file-type/cfbf

Detector plugin for file-type that identifies files based on the Compound File Binary Format, commonly known as CFBF or OLE Compound Document.

CFBF is a container format used by many legacy Microsoft Office files and other Windows applications. This plugin detects the container itself, not the specific document content inside it.

Installation

npm install @file-type/cfbf

Usage

The following example shows how add the CFBF detector to file-type.

import {FileTypeParser} from 'file-type';
import {detectCfbf} from '@file-type/cfbf';

const parser = new FileTypeParser({customDetectors: [detectCfbf]});
const fileType = await parser.fromFile('smaple.doc');
console.log(fileType);

Support file formats

This detector identifies files that use the Compound File Binary Format Format container:

Microsoft Office legacy formats

These are pre-Office Open XML binary Office formats (CFBF/OLE), used by Microsoft Office prior to Office 2007:

  • .doc Microsoft Word documents (Word 6.0/95, Word 97–2003)
  • .pub Microsoft Publisher documents (Publisher 3.0/95-4.0/97, Publisher 5.0/98)
  • .ppt Microsoft PowerPoint presentations (PowerPoint 4.0, 7.0/95, 97–2003)
  • .vsd Microsoft Visio drawings (2000–2002, 2003–2010)
  • .wps Microsoft Works 7–9 Word Processor Document
  • .xls Microsoft Excel spreadsheets (Excel 5.0/95, Excel 97–2003)

Other files:

Licence

This project is licensed under the MIT License. Feel free to use, modify, and distribute as needed.

版本与发布记录

@file-type/cfbf 共发布 5 个版本,首次发布于 2026/01/08;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.2.2latest2026/01/259 个月前
0.2.12026/01/159 个月前
0.2.02026/01/1110 个月前
0.1.12026/01/0910 个月前
0.1.02026/01/0810 个月前

关于 @file-type/cfbf 的常见问题

@file-type/cfbf 是什么?

Compound File Binary Format (CFBF) detection plugin for file-type

如何安装 @file-type/cfbf?

在项目目录运行 npm install @file-type/cfbf,或使用 pnpm add / yarn add / bun add。

@file-type/cfbf 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@file-type/cfbf 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@file-type/cfbf 可以商用吗?

@file-type/cfbf 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@file-type/cfbf 的下载量有多少?

根据 npm 官方下载统计,@file-type/cfbf 在 2026/10/15 – 2026/11/13 这 30 天内被下载 92,202 次,日均约 3,073 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@file-type/cfbf 还在维护吗?

最新版本 0.2.2 发布于 2026/01/25(9 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/01/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。