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

img2txtio

v1.1.0

Published

An SDK for interacting with the Img2Txt.io API to extract text from images.

Readme

img2txt.io Javascript Package

A Javascript Package for the img2txt.io API. Easily upload images and convert them to plain text or structured output programmatically.

Installation

npm install img2txtio

Or install directly from source:

git clone https://github.com/Astro-gram/img2txt-javascript-package.git
cd img2txt-javascript-package
pip install .

Quick Start

import { Img2TxtClient } from "img2txtio";

// Initialize client with your API key
const client = new Img2TxtClient("YOUR_API_KEY_HERE");

(async () => {
    try {
        // Convert an image to plain text
        const result = await client.process(
            "path/to/image.jpg",              // image_path
            "raw",                            // output_type (default: raw)
            "Receipt from grocery",           // description (optional)
            ""                                // outputStructure (optional JSON string)
        );
        // `result` is an object containing the API response
        console.log(result);
    } catch (error) {
        console.error(error);
    }
})();

API Reference

Class: Img2TxtClient

__init__(api_key: string)

Create a new client instance.

process(imagePath: string, outputType: string = "raw", description: string = "", outputStructure: string = ""): Promise<Record<string, any>>

Uploads the image at image_path and converts it to text or structured output.

Parameters:

  • image_path (string): Local path to the image file. Must exist, otherwise raises FileNotFoundError.
  • output_type (string): The output format. Defaults to raw. Other valid types depend on the API (e.g., json, structured).
  • description (string): Optional description or context to improve text extraction.
  • outputStructure (string): Optional JSON string defining a structure/schema for the output. Must be valid JSON or raises ValueError.

Returns:

  • dict: Parsed JSON response from the API. On failure, raises RuntimeError.
  • Example response:
    {
        'text_output': [
            'Los Angeles', 'Florida', '$235', 'Round trip', 'Economy',
            '1 passenger', 'Lowest total price'
        ],
        'job_id': '16e2364a-e1e2-468e-9be9-e07b695b2afd',
        'creditsLeft': 86.115,
        'success': True,
        'message': 'Image processed successfully.'
    }

Error Handling

  • Network or HTTP errors raise requests.exceptions.HTTPError.
  • Missing files raise FileNotFoundError.
  • Invalid JSON in outputStructure raises ValueError.
  • API failures raise RuntimeError.

License

This project is licensed under the MIT License. See the LICENSE file for details.