// add RTF as external file

import { CreateDocx, OptionsAltchunk } from "../../../build";
import * as fs from "fs";

const docx = new CreateDocx();

const fileRtf = fs.readFileSync("../../files/Test.rtf");

docx.addText(
    "Insert a RTF file (this method is not supported by all DOCX readers):"
);

const externalFile: OptionsAltchunk = {
    file: fileRtf,
    type: "rtf",
};
docx.addExternalFile(externalFile);

docx.addText("A new paragraph");

docx.save().then(contents => {
    fs.writeFileSync("addExternalFile_3.docx", Buffer.from(contents));
});
