You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

doc-textify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doc-textify

A Node.js library to extract text from office documents (docx, pptx, xlsx, odt, odp, ods, pdf, text, html ...)

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

npm version

Doc-Textify

Doc-Textify is a TypeScript library and command-line tool that extracts and cleans text from various document formats.

🚀 Features

  • Multi-format support:

    • Microsoft Word (.docx)
    • PowerPoint (.pptx)
    • Excel (.xlsx)
    • OpenOffice/LibreOffice (.odt, .odp, .ods)
    • PDF (.pdf)
    • Plain text (.txt)
    • HTML (.html, .htm)
  • Content cleaning: removes extra whitespace, handles custom line delimiters.

  • Configurable options: set newline delimiter, minimum characters to extract, and toggle error logging.

📦 Library Usage

Install the package and import it in your project:

npm install doc-textify --save
import { docTextify } from 'doc-textify'

// async/await version
try {
    const text = await docTextify('path/to/file.pdf')
} catch (e) {
    console.error(err)
}

// or callback version
docTextify('path/to/file.pdf')
    .then(text => console.log(text))
    .catch(err => console.error(err))

Default options:

try {
  const text = await docTextify('path/to/file.pdf', {
      newlineDelimiter: '\n', // output content delimiter
      minCharsToExtract: 0, // number of chars required to output the content, default disabled (0)
      outputErrorToConsole: true // log error to console
      })
  } catch (e) {
      console.error(err)
  }

🚀 CLI Usage (Optional)

If you prefer a ready-made command, the doc-textify CLI wraps the same functionality:

Installation

Global install to use the doc-textify command anywhere:

npm install -g doc-textify

Or install locally:

npm install doc-textify --save

Command

doc-textify <path/to/document> [options]

Options

OptionDescriptionDefault
-n, --newlineDelimiterLine delimiter to insert"\n"
-m, --minCharsToExtractMinimum number of characters to extract0 (disabled)
-h, --helpDisplay help message

Example

doc-textify document.docx -n "\r\n" -m 20 > output.txt

📥 Installation from Source

git clone https://github.com/johaven/doc-textify.git
cd doc-textify
npm install
npm run build    # outputs compiled files into /dist
npm run test     # test parsing

🤝 Contributing

  • Fork the repository
  • Create a branch: git checkout -b feature/my-feature
  • Commit your changes: git commit -m "Add my feature"
  • Push to your branch: git push origin feature/my-feature
  • Open a Pull Request

📄 License

This project is licensed under the MIT License.

Keywords

office

FAQs

Package last updated on 06 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts