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

@ircg/sdk

v1.28.2

Published

Complete SDK for IRCG services - includes TES, IOS, USS, FSS, and PGS clients

Readme

@ircg/sdk

Complete TypeScript/JavaScript SDK for IRCG services:

  • TES — Transactional Email Service
  • IOS — Image Optimization Service
  • USS — URL Shortener Service
  • FSS — File Storage Service
  • PGS — PDF Generation Service

Installation

pnpm add @ircg/sdk

Install an individual package instead when an application only uses one service.

Clients

import { FSSClient, IOSClient, PGSClient, TESClient, USSClient } from '@ircg/sdk'

const apiKey = process.env.IRCG_API_KEY!
const fss = new FSSClient({ apiKey, lang: 'en' })
const ios = new IOSClient({ apiKey, lang: 'en' })
const pgs = new PGSClient({ apiKey, lang: 'en' })
const tes = new TESClient({ apiKey, lang: 'en' })
const uss = new USSClient({ apiKey, lang: 'en' })

Keep production API keys on the server. Client configuration accepts a custom baseUrl, lang: 'es' | 'en', and service-specific options such as dryRun. IOS and FSS also accept a custom mediaUrl for local or preview delivery.

Safe and unsafe methods

Methods without an Unsafe suffix return a discriminated result containing either error or the operation's success shape. For example, TES returns { email_sent }, while PGS returns both the PDF response and its billing metadata:

const result = await tes.sendText({
	fields: ['id', 'createdAt'],
	from: '[email protected]',
	subject: 'Welcome',
	text: 'Your account is ready.',
	to: '[email protected]',
})

if (result.error) console.error(result.error.status, result.error.message)
else console.log(result.email_sent.id)

Most remote methods also have an Unsafe variant that throws typed IRCG errors. The exception is FSS abortMultipartUpload(), which only exposes its safe result:

import { IRCGAuthenticationError, IRCGError, IRCGRateLimitError, IRCGValidationError } from '@ircg/sdk'

try {
	const { email_sent: email } = await tes.sendTextUnsafe({
		fields: ['id'],
		from: '[email protected]',
		subject: 'Welcome',
		text: 'Your account is ready.',
		to: '[email protected]',
	})
	console.log(email.id)
} catch (error) {
	if (error instanceof IRCGAuthenticationError) console.error('Invalid API key')
	else if (error instanceof IRCGValidationError) console.error('Invalid request', error.details)
	else if (error instanceof IRCGRateLimitError) console.error('Rate limit exceeded')
	else if (error instanceof IRCGError) console.error(error.status, error.message)
}

Service examples

Service operations that support selectable JSON metadata require an explicit fields array so the response type contains only the selected fields. PGS does not accept fields: it returns a PDF stream plus fixed billing metadata.

Optimize an image

const uploaded = await ios.upload({
	image,
	requireSignedURLs: false,
	fields: ['imageId', 'currentVariants'],
})

if (uploaded.error) throw new Error(uploaded.error.message)
console.log(ios.getImageUrl(uploaded.optimizedImage.imageId, '500x500'))

Shorten a URL

const shortened = await uss.create({
	url: 'https://example.com/a/very/long/path',
	fields: ['urlKey', 'originalUrl'],
})

if (shortened.error) throw new Error(shortened.error.message)
console.log(`https://ircg.dev/l/${shortened.shortenedUrl.urlKey}`)

Stream a file

const download = await fss.download({ fileId: 'd290f1ee-6c54-4b01-90e6-d701748f0851' })

if (download.error) throw new Error(download.error.message)
return download.response

Generate a PDF

import { createWriteStream } from 'node:fs'
import { Readable } from 'node:stream'
import { pipeline } from 'node:stream/promises'

const pdf = await pgs.generate({
	fileName: 'invoice.pdf',
	url: 'https://example.com/invoices/123',
})

if (pdf.error) throw new Error(pdf.error.message)
if (!pdf.response.body) throw new Error('PGS returned an empty PDF stream')
await pipeline(Readable.from(pdf.response.body), createWriteStream('invoice.pdf'))
console.log(pdf.billing)

Types and errors

The aggregate package re-exports every public type from @ircg/core and each service package, together with the core error classes:

import type { GeneratePDFRequest, SendEmailRequest, StoredFile } from '@ircg/sdk'
import {
	IRCGAuthenticationError,
	IRCGError,
	IRCGRateLimitError,
	IRCGServerError,
	IRCGValidationError,
} from '@ircg/sdk'

Individual packages

pnpm add @ircg/tes # Transactional email
pnpm add @ircg/ios # Image optimization
pnpm add @ircg/uss # URL shortening
pnpm add @ircg/fss # File storage
pnpm add @ircg/pgs # Server-side PDF generation

Documentation

License

MIT