docx-list-style

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i docx-list-style

Weekly Downloads

4

Version

0.1.2

License

MIT

Unpacked Size

29.4 kB

Total Files

9

Last publish

Collaborators

  • francisbrito