sandbox-mammoth
GitHub提供在沙箱环境中读取Word文档的功能,支持将.docx转换为纯文本或HTML。适用于需要解析文档内容而非渲染的场景,限制单文件10MB且仅支持读取操作。
Trigger Scenarios
Install
npx skills add nodetool-ai/nodetool --skill sandbox-mammoth -g -y
SKILL.md
Frontmatter
{
"name": "sandbox-mammoth",
"description": "Read a Word document as text or HTML in a Code node or CodeAct action, with mammoth running on the host"
}
Word documents in the sandbox (reading)
Specifier: @nodetool-ai/sandbox-mammoth. Import it at the top of the body.
mammoth reads a .docx buffer through Node's own zip/XML stack; it will never
be a guest module. This pack is a host module: the import resolves to a
generated facade over NodeTool's own implementation.
extractRawText — docx bytes to plain text
import { extractRawText } from "@nodetool-ai/sandbox-mammoth";
const bytes = await workspace.readBytes("report.docx");
const text = await extractRawText(bytes);
Formatting is discarded — this is the fast path when you only need the words.
convertToHtml — docx bytes to HTML
import { convertToHtml } from "@nodetool-ai/sandbox-mammoth";
const html = await convertToHtml(bytes);
Headings, lists, tables, bold/italic runs, and embedded images (as base64 data URIs) survive the conversion. Track changes, headers/footers, footnotes, and exact visual layout do not — mammoth targets semantic HTML, not a pixel-exact render.
Get the bytes from workspace.readBytes, or from a fetched body with
await response.bytes().
Gotchas
- Both exports are async.
- 10 MB per document. Larger input is refused by name.
- Reading only. To build a
.docx, use@nodetool-ai/sandbox-docxinstead.
Version History
- a6a7e57 Current 2026-08-20 09:52


