const mammoth = require("mammoth");
mammoth.extractRawText({ path: "example.docx" })
.then(result => {
console.log(result.value); // The raw text
})
.catch(err => {
console.error(err);
});
const fs = require('fs');
const mammoth = require('mammoth');
async function readDocxFile(filePath) {
const arrayBuffer = await fs.promises.readFile(filePath);
const result = await mammoth.convertToHtml({ arrayBuffer });
console.log(result.value); // The HTML content
}
Other supported platforms
alternatives
No comments:
Post a Comment