js实现多个word合并,使用docx-merger库

sh 复制代码
npm i -s docx-merger
dart 复制代码
var DocxMerger = require("docx-merger");

var fs = require("fs");
var path = require("path");

var file1 = fs.readFileSync(
  path.resolve(__dirname, "1.docx"),
  "binary"
);

var file2 = fs.readFileSync(
  path.resolve(__dirname, "2.docx"),
  "binary"
);

var docx = new DocxMerger({}, [file1, file2]);

//SAVING THE DOCX FILE

docx.save("nodebuffer", function (data) {
  // fs.writeFile("output.zip", data, function(err){/*...*/});
  fs.writeFile("output.docx", data, function (err) {
    /*...*/
  });
});

todo

页面方式使用

相关推荐
BerryS3N17 分钟前
前端应用的离线暂停更新策略:构建稳定可靠的渐进式部署方案
前端
LaughingZhu44 分钟前
Product Hunt 每日热榜 | 2026-07-17
前端·数据库·人工智能·经验分享·mysql·chatgpt·html
潇凝子潇1 小时前
UnsupportedOperationException
java·前端·数据库
卷无止境1 小时前
Python 跨平台 GUI 解决方案全景报告
前端·python
万少8 小时前
用腻了 WorkBuddy 的默认界面?这个开源小工具给它换上了毛玻璃
前端·javascript·后端
To_OC9 小时前
LC 15 三数之和:双指针不难,难的是把去重做对
javascript·算法·leetcode
触底反弹10 小时前
🔥 前端也能玩转 AI 流式输出!从二进制流到打字机效果,一篇讲透
javascript·人工智能·node.js
胡萝卜术10 小时前
深度重构:Agent Skills——从 Prompt 工程到能力工程
javascript·架构·github
海上彼尚11 小时前
Nodejs也能写Agent - 16.LangGraph篇 - 条件分支与循环
前端·后端·langchain·node.js
To_OC12 小时前
从 “卡死半天” 到 “打字机效果”:大模型流式输出前端实现全记录
前端·javascript·llm