Skip to content

francisbrito/node-docx-list-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docx-list-style

Lists the styles in a Word (.docx) file.

Installation

$ yarn add docx-list-style

Or, if using npm:

$ npm install --save docx-list-style

Usage

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);

Command-line

npx docx-list-style <... path to Word file ...>
# outputs:
# Heading1
# Heading2
# Heading3
# ...

API

TODO

About

Lists the styles in a Word (.docx) file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published