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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@christophervr/ole2

v0.2.0

Published

Shared MS-CFB compound-file and legacy Microsoft Office binary codecs

Readme

@christophervr/ole2

Framework-neutral primitives for legacy Office compound files. Shared by the PowerPoint and Word viewers without copying implementations.

npm install @christophervr/ole2

Read the API guide and examples.

Scope

  • MS-CFB/OLE2 compound-file stream reading and writing, including mini streams, FAT/DIFAT and directory metadata.
  • Word 97-2003 binary .doc main-body text reading and guarded existing-paragraph text editing.
  • Excel BIFF8 .xls first-worksheet previews and bounded numeric/string cell edits.
  • PowerPoint .ppt binary export from a framework-neutral model, including text, shapes, pictures, notes, embedded objects and optional RC4 encryption, plus record headers, traversal and constants.
  • Visio and Publisher binary structure inspection, plus standard OLE document-property reading and bounded text-property edits. Drawing and publication page content is not yet decoded or editable.
  • Path-based compound stream edits preserve nested storage layout and all bytes outside the edited stream.
  • No browser or framework dependency; typed-array/ArrayBuffer inputs and ESM JavaScript with TypeScript declarations.
import { buildOle2, parseOle2 } from '@christophervr/ole2';
const bytes = buildOle2(new Map([['Example', new Uint8Array([1, 2, 3])]]));
const file = parseOle2(bytes);
console.log(file.getStream('Example'));

Granular subpaths expose the ole2-parser-*, ole-document-doc-*, legacy-excel-* and legacy-ppt-* modules. This is a codec library, not a complete legacy Office renderer. The API guide describes each format's supported subset.

import {
	identifyLegacyOffice,
	readOleXlsGrid,
	writeOleXlsNumericCellEdit,
} from '@christophervr/ole2';

const kind = identifyLegacyOffice(fileBytes); // Uint8Array or ArrayBuffer
const grid = readOleXlsGrid(xlsBytes); // Uint8Array; first worksheet, bounded preview
const edited = writeOleXlsNumericCellEdit(xlsBytes, { row: 0, col: 0, value: 42 });
if (edited === xlsBytes) console.log('This edit was not supported.');

Excel previews do not evaluate formulas or resolve every continued shared string. Editing is constrained by record type, workbook structure and string-table layout. Unsupported edits return the exact input byte array; callers should check that result before reporting success.

import { readLegacyOfficeMetadata, writeLegacyOfficeMetadata } from '@christophervr/ole2';

console.log(readLegacyOfficeMetadata(fileBytes));
const edited = writeLegacyOfficeMetadata(fileBytes, 'title', 'New title');
// Existing SummaryInformation property only; the value must fit its allocated slot.
// Supported string encodings are Windows-1250 through Windows-1258 and UTF-16.
if (edited === fileBytes) console.log('Unchanged or unsupported edit.');

Legacy PowerPoint export

import { buildPptFile } from '@christophervr/ole2/legacy-ppt-writer';

const pptBytes = await buildPptFile({
	widthEmu: 9144000,
	heightEmu: 5143500,
	slides: [{ shapes: [] }],
	pictures: [],
});
// Save pptBytes as a .ppt file. Pass { password: '...' } as a second argument
// only when legacy RC4 output is required.

The writer consumes the typed WDeck model. Converting a PowerPoint viewer document into that model remains in pptx-viewer-core; it consumes this shared binary implementation.

Development

bun install --frozen-lockfile
bun run typecheck
bun run test
bun run build
bun run test:package

The packed-package smoke test installs the tarball into an independent temporary npm project and exercises the public API. The build clears its own dist directory so removed codecs cannot accidentally remain in a release. Only compiled output, license, notice and readme ship to npm.