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

@easy-translate/office

v0.2.2

Published

Translate DOCX, PPTX and XLSX files while preserving OOXML formatting.

Readme

@easy-translate/office

用于翻译 DOCX、PPTX 和 XLSX 文件的 Node.js ESM 包,尽量保留 OOXML 结构、文本样式和工作簿布局。

安装

npm install @easy-translate/office

TypeScript API

import {
  translateOfficeBuffer,
  type TranslationProvider,
} from "@easy-translate/office";

const provider: TranslationProvider = {
  async translateBatch(request) {
    return request.items.map((item) => ({
      id: item.id,
      text: item.text,
    }));
  },
};

const result = await translateOfficeBuffer(input, "report.docx", {
  provider,
  sourceLanguage: "en",
  targetLanguage: "zh-CN",
});

底层 adapter 可从 @easy-translate/office/office-adapter 导入;OpenAI 兼容与通用 HTTP Provider 由 @easy-translate/providers 提供,也可继续从 @easy-translate/office/providers 导入 Node 封装(支持 apiKeyEnv)。翻译执行能力和通用类型由 @easy-translate/core 提供。

Office 根入口同时重导出 core 的结构化错误 API,包括 TranslationErrorCodeTranslationConfigurationErrorTranslationPlanErrorTranslationResponseErrorTranslationProviderErrorisTranslationCoreError。内置 HTTP Provider 会把状态码、重试能力、Retry-After、request ID 和上游原始错误码分别保存为 statusretryableretryAfterMsdetails.requestIdproviderCode;上游响应正文不会拼入标准错误消息。

ProviderResponseError 保留现有类名、构造方式和 instanceof OfficeTranslatorError 兼容,同时属于 TranslationResponseError,因此模型 JSON 或结果结构不完整时仍可由 core 执行格式修复重试。Provider 实现不应抛出普通 Error 来表示可重试故障;未知异常默认不会重试。

CLI

npm install -g @easy-translate/office
office-translate ./input.docx --to zh-CN --config ./office-translator.config.mjs

支持 Word 正文、页眉页脚、批注,PowerPoint 文本、备注、母版、图表、图示,以及 Excel 共享字符串、内联字符串和图表等 OOXML 内容。宏文件会保留原有包结构;不执行 Office 宏。