html-text-extractor
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

html-text-extractor

An HTML parsing library for Node.js, designed to extract text sections associated with anchor tags and headings from HTML files in a directory and its subdirectories. The extracted text is structured for indexing in a full-text search engine. The library produces an array of sections, each with properties for the URL (based on the file path), the anchor (if present), the title (based on the following heading tag), and the text.

Features

  • Extracts text from HTML files in a folder (and it's sub-folders)
  • Available as a simple API
  • Just 624 byte nano sized (ESM, gizpped)
  • Tree-shakable and side-effect free
  • First class TypeScript support
  • 100% Unit Test coverage

Example usage (API, as a library)

Setup

  • yarn: yarn add html-text-extractor
  • npm: npm install html-text-extractor

ESM

import { extract } from 'html-text-extractor'

const result = await extract('./dist')

CommonJS

const { extract } = require('html-text-extractor')

// same API like ESM variant

Package Sidebar

Install

npm i html-text-extractor

Weekly Downloads

4

Version

1.1.1

License

MIT

Unpacked Size

45.2 kB

Total Files

12

Last publish

Collaborators

  • kyr0