Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ya-kostik/docx-stream-template

Simple stream template engine for create docx files in NodeJS
https://github.com/ya-kostik/docx-stream-template

docx node nodejs stream template variables

Last synced: about 1 month ago
JSON representation

Simple stream template engine for create docx files in NodeJS

Awesome Lists containing this project

README

        

# docx-stream-template
Simple stream template engine for create docx files in NodeJS

## Install

```
npm i --save docx-stream-template
```

## Use
Add to your docx file constructions like that:
```
Hello dear {{anotherBoringVariableName}}!
Good bye!
```
Then just call template function:
```javascript
const template = require('docx-stream-template');

template({
anotherBoringVariableName: 'Bulochka',
}, fs.createReadStream(path.join(__dirname, './test.docx'))).
pipe(fs.createWriteStream(path.join(__dirname, './donetest.docx')));
```
The first parameter of template function is object with variables, what you can use in the docx file.

Thats all!