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

@berryn/xlsx-inspect

v0.2.1

Published

Berryn XLSX Inspection — ZIP container inventory, OPC relationship graph resolver, and feature classification

Readme

@berryn/xlsx-inspect

Bounded XLSX package ZIP archive reader and Open Packaging Conventions (OPC) relationship parser.

npm version License: MIT Node.js TypeScript


Overview

@berryn/xlsx-inspect performs deep structural inventory and relationship graph extraction on Open Packaging Conventions (OPC) spreadsheet packages (.xlsx, .xlsm, .xltx).

It safely reads ZIP container archives using bounded memory constraints, parses [Content_Types].xml and _rels/.rels graphs, and classifies every package part against Berryn's 5-tier support taxonomy.


Installation

# Using pnpm
pnpm add @berryn/xlsx-inspect

# Using npm
npm install @berryn/xlsx-inspect

5-Tier Part Classification Taxonomy

Every ZIP entry in the OOXML package is evaluated and assigned to a tier:

| Tier | Meaning | Examples | |---|---|---| | supported | Fully modeled and semantically validated by Berryn. | xl/workbook.xml, xl/worksheets/sheet1.xml, xl/styles.xml, xl/sharedStrings.xml | | partially-supported | Modeled with bounded feature coverage. | xl/tables/table1.xml, xl/theme/theme1.xml | | preserved-not-modeled | Opaque binary/XML preserved byte-for-byte to prevent silent data loss. | xl/pivotTables/pivotTable1.xml, xl/drawings/drawing1.xml, xl/media/image1.png, customXml/* | | unsupported | Known OOXML feature currently out of scope. Emits audit warning. | xl/vbaProject.bin, xl/activeX/* | | rejected | Hazardous, unrecognized, or invalid part violating safety invariants. | Unrecognized executable binaries or corrupted parts |


Usage Examples

1. Inspecting an XLSX Workbook Buffer

import { readFileSync } from 'node:fs';
import { inspectXlsx } from '@berryn/xlsx-inspect';

const buffer = readFileSync('financial_model.xlsx');
const { value: report, diagnostics } = inspectXlsx(buffer);

console.log(`Total Entries: ${report.containerMeta.totalEntries}`);
console.log(`Uncompressed Size: ${report.containerMeta.totalUncompressedBytes} bytes`);
console.log(`Unsupported Parts: ${report.unsupportedPartCount}`);

for (const part of report.parts) {
  console.log(`[${part.classification.toUpperCase()}] ${part.partPath} (${part.contentType})`);
}

2. Low-Level Bounded ZIP Container Reading

import { readZipContainer } from '@berryn/xlsx-inspect';
import { DEFAULT_RESOURCE_LIMITS } from '@berryn/core';

const { container, diagnostics } = readZipContainer(buffer, DEFAULT_RESOURCE_LIMITS);

for (const meta of container.meta) {
  console.log(`Path: ${meta.path}, Size: ${meta.uncompressedSize} bytes, CRC32: ${meta.crc32}`);
}

3. Parsing OPC Relationships and Content Types

import { parseContentTypesXml, parseRelsXml } from '@berryn/xlsx-inspect';

// Parse [Content_Types].xml
const contentTypesXml = new TextDecoder().decode(container.entries.get('[Content_Types].xml')!);
const { contentTypes } = parseContentTypesXml(contentTypesXml);

console.log('Overrides:', contentTypes.overrides);

// Parse root _rels/.rels
const relsXml = new TextDecoder().decode(container.entries.get('_rels/.rels')!);
const { relationships } = parseRelsXml(relsXml);

for (const rel of relationships) {
  console.log(`ID: ${rel.id} -> Type: ${rel.type} -> Target: ${rel.target}`);
}

Exported Symbols

| Symbol | Category | Description | |---|---|---| | inspectXlsx | Function | High-level inspector returning full metadata, part classifications, and OPC relations. | | readZipContainer | Function | Safe, memory-bounded ZIP decompression and entry extraction (fflate). | | parseContentTypesXml | Function | Extracts Default extension mappings and Override part content types. | | parseRelsXml | Function | Parses OOXML relationship XML documents into typed OpcRelationship[] records. | | classifyOpcPart | Function | Maps part path and MIME content-type to one of the 5 classification tiers. | | XlsxInspectionReport | Interface | Aggregate inspection report containing container metrics, parts, and diagnostics. | | PartClassification | Interface | Structure describing path, content type, tier, and associated diagnostic notes. |


Links