tika-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

tika-js

Tika JavaScript / TypeScript Client

Installation

  • npm install tika-js
  • yarn add tika-js

Usage

import { createReadStream, createWriteStream } from 'fs'
import { TikaClient } from 'tika-js'

const client = new TikaClient({ host: 'http://127.0.0.1:9998' })

// Version
console.info('version', await client.getVersion())

// Extract Text
const txt = await client.getContent(createReadStream('data/input.pdf'), 'text/plain')

// Extract XML
const xml = await client.getContent(createReadStream('data/input.pdf'), 'text/xml')

// Extract HTML
const html = await client.getContent(createReadStream('data/input.pdf'), 'text/html')

// Extract JSON
const json = await client.getContent(createReadStream('data/input.pdf'), 'application/json')

// Pipe
await client.pipe(
  createReadStream('data/input.pdf'),
  createWriteStream('data/output.txt'),
  'text/plain' // 'text/xml' | 'text/html' | 'application/json'
)

main()

Readme

Keywords

none

Package Sidebar

Install

npm i tika-js

Weekly Downloads

11

Version

1.0.2

License

MIT

Unpacked Size

9.76 kB

Total Files

11

Last publish

Collaborators

  • tstrebitzer