Lists the styles in a Word (.docx) file.
$ yarn add docx-list-style
Or, if using npm
:
$ npm install --save docx-list-style
With Buffer
-s:
const listDocxStyles = require('docx-list-style');
const getStream = require('get-stream');
const MY_WORD_FILE = '<... path to Word file ...>';
listDocxStyles
.fromBuffer(getStream.buffer(fs.createReadStream(MY_WORD_FILE), { encoding: 'binary' })) // NOTE: make sure to open file in binary mode.
.then(console.log)
.catch(console.error);
With Stream
-s:
const listDocxStyles = require('docx-list-style');
const MY_WORD_FILE = '<... path to Word file ...>';
listDocxStyles
.fromStream(fs.createReadStream(MY_WORD_FILE))
.then(console.log)
.catch(console.error);
With a file path:
const listDocxStyles = require('docx-list-style');
const MY_WORD_FILE = '<... path to Word file ...>';
listDocxStyles
.fromFilePath(MY_WORD_FILE)
.then(console.log)
.catch(console.error);
npx docx-list-style <... path to Word file ...>
# outputs:
# Heading1
# Heading2
# Heading3
# ...
TODO