From 149cda9a3b51e01358359ee6e5543a04127fa65e Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Wed, 2 Jan 2019 15:53:28 +0000 Subject: [PATCH] Fix getting started docs for v4 packer. --- docs/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 4fc5757477..fd5ad9ecd9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -29,6 +29,7 @@ import * as docx from "docx"; ## Basic Usage ```js +var fs = require("fs"); var docx = require("docx"); // Create document @@ -41,11 +42,12 @@ paragraph.addRun(new docx.TextRun("Lorem Ipsum Foo Bar")); doc.addParagraph(paragraph); // Used to export the file into a .docx file -var exporter = new docx.LocalPacker(doc); +var packer = new docx.Packer(); +packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My First Document.docx", buffer); +}); -exporter.pack("My First Document"); - -// Done! A file called 'My First Document.docx' will be in your file system if you used LocalPacker +// Done! A file called 'My First Document.docx' will be in your file system. ``` ## Honoured Mentions