npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

any-extractor

v2.0.5

Published

A universal text extractor for files.

Readme

AnyExtractor

NPM Version License Downloads

A Node.js package to extract text from files.

Features

  • Flexible input options: Supports local file path, buffers, and file URLs.
  • Auto type detection: Automatically detects file type and extracts text using MIME type.
  • Customizable parsers: Allows creating new or modifying existing document parsers for any MIME types.
  • Confluence support: Extracts text from Confluence documents.

Supported Files

Here's a breakdown of the text extraction capabilities for each file type:

| File Type | Text Extraction | | ------------------------------------------------ | --------------- | | .docx | ✅ | | .pptx | ✅ | | .xlsx | ✅ | | .pdf | ✅ | | .odt | ✅ | | .odp | ✅ | | .ods | ✅ | | .csv | ✅ | | .txt | ✅ | | .json | ✅ | | Plain text (e.g., .py, .ts, .md, etc.) | ✅ | | confluence | ✅ |

Installation

npm install any-extractor

Getting Started

import { getAnyExtractor } from 'any-extractor';

async function extractFromFile() {
  const anyExt = getAnyExtractor();
  const text = await anyExt.parseFile('./filename.docx');
  console.log('Extracted Text:', text);
}

extractFromFile();

Advanced Usage

Authorization Parameter

The second argument in parseFile, shown as null, is for Basic Authentication when accessing file URLs. Format: Basic <base64-encoded-credentials>

Example:

const authString = 'Basic ' + Buffer.from('user:password').toString('base64');
const text = await anyExt.parseFile('https://example.com/protected-file.docx', authString);
console.log('Extracted Text:', text);

Custom Parsers:

AnyExtractor is designed with extensibility in mind, allowing you to integrate your own custom document parsers for handling specific or less common file formats, or to implement tailored text extraction logic. To create custom parser, you will need to implement AnyParserMethod class with the following signature:

  • mimes: string[]: class variable which has the list of mime types for your targeted files.
  • apply: (buffer, mime, options, config): class method which returns the extracted text as string.
    • buffer: file buffer
    • mime: mime type of the file
    • options?: second argument of extractText method
    • config?: argument of getAnyExtractor method

Create your extractor class implementing the AnyParserMethod.

import { AnyParserMethod } from 'any-extractor';

export class CustomParser implements AnyParserMethod {
  public mimes = ['application/hdb', 'application/sql'];

  public apply = async (file: Buffer, extractorConfig: ExtractorConfig): Promise<string> => {
    // your text extraction logic
  };
}

Add your custom parser to any extractor instance.

const anyExt = getAnyExtractor();
anyExt.addParser(new CustomParser());
const text = await anyExt.extractText('./filename.sql');
console.log('Extracted Text:', text);

Creating custom parsers for existing mimetypes will overwrite the implementation.

Confluence Crawling

Extract text from Confluence documents:

const { getAnyExtractor } = require('any-extractor');

async function crawlConfluence() {
  const textExt = getAnyExtractor({
    confluence: {
      baseUrl: '<baseurl>',
      email: '<username>',
      apiKey: '<api-key>',
    },
  });

  const result = await textExt.parseConfluenceDoc('<pageId>');
}

crawlConfluence();

License

MIT

Report

If you encounter bugs or have feature requests, open an issue. Feel free to start a discussion — whether it’s feedback, a question, or an idea!

Support

Buy Me a Coffee