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

@senlinz/import-export-wasm

v1.0.0

Published

Rust WebAssembly for import/export excel files

Readme

@senlinz/import-export-wasm

用于导入、导出和生成 Excel 工作簿的 Rust / WebAssembly 直接绑定。

English

安装

pnpm add @senlinz/import-export-wasm

初始化

先构建包,再在浏览器中加载生成的模块:

import init, {
  createTemplate,
  exportData,
  importData,
  ExcelInfo,
  ExcelColumnInfo,
  ExcelData,
  ExcelRowData,
  ExcelColumnData,
} from '@senlinz/import-export-wasm';

await init();

直接使用 WASM

const info = new ExcelInfo(
  'TomAndJerry',
  'sheet1',
  [
    new ExcelColumnInfo('name', 'Name'),
    new ExcelColumnInfo('age', 'Age').withDataType('number'),
    new ExcelColumnInfo('category', 'Category').withAllowedValues(['Cat', 'Mouse']),
  ],
  'senlinz',
  '2024-11-01T08:00:00',
);

const template = createTemplate(info);

const data = new ExcelData([
  new ExcelRowData([
    new ExcelColumnData('name', 'Tom'),
    new ExcelColumnData('age', '12'),
    new ExcelColumnData('category', 'Cat'),
  ]),
]);

const workbook = await exportData(info, data);
const imported = importData(info, workbook);

支持的 Schema 规则

  • 列 key 必须唯一。
  • 表头名称不能为空。
  • dataType 仅支持 textnumberdateimage
  • 父级列必须先于子级列声明。
  • dataGroupParent 必须引用已声明的 dataGroup

直接 WASM 示例

该浏览器示例由 ./tests/wasm.test.js 中的 Playwright 用例覆盖。

运行时说明

  • 浏览器使用前需要通过 wasm-pack build 生成 JS / WASM 产物。
  • 生成的 pkg/ 目录属于构建产物,不会提交到 git。
  • 图片导出需要 .withImageFetcher(...)
  • 非法 schema、非法数字值、非法日期值都会返回明确错误。

开发

cargo test --lib
wasm-pack build --release --target web
corepack pnpm install
corepack pnpm exec playwright install chromium
npm run e2e-test