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

@transloadit/utils

v4.10.0

Published

Transloadit shared utilities

Readme

@transloadit/utils

Shared runtime helpers used across Transloadit JavaScript SDKs.

Install

npm install @transloadit/utils

Web / Edge usage

Everything in the root export runs on WebCrypto, so it works in browsers (secure origins only: https:// or localhost), edge runtimes, and Node.

import {
  getSignedSmartCdnUrl,
  getSmartCdnUrl,
  parseSmartCdnUrl,
  signParams,
  stripSmartCdnAuth,
  verifyWebhookSignature,
} from '@transloadit/utils'

const signature = await signParams(paramsString, authSecret)
const verified = await verifyWebhookSignature({
  rawBody,
  signatureHeader,
  authSecret,
})
const url = await getSignedSmartCdnUrl({
  workspace,
  template,
  input,
  authKey,
  authSecret,
})

Smart CDN URL grammar

The URL builders and parser share one grammar, so a URL built here parses back into the options that built it (and vice versa):

// Unsigned, for workspaces that do not require signature authentication.
const publicUrl = getSmartCdnUrl({ workspace, template, input, urlParams: { w: 640 } })

// Inverse of the builders: percent-decodes once, keeps repeated params as arrays,
// and returns `auth_key`/`exp`/`sig` separately as `auth`.
const { workspace, template, input, urlParams, auth } = parseSmartCdnUrl(url)

// Drops `auth_key`, `exp`, `sig` (and api2's `hsh`), leaving every other byte untouched.
const unsigned = stripSmartCdnAuth(url)

auth_key, exp, and sig are reserved: signed builders replace them and the unsigned builder omits them. Other fields, including hsh, round-trip through the builders and parser.

Both builders accept a baseUrl that replaces https://{workspace}.tlcdn.com, for example a local api2's URL Transform endpoint https://api2-devdock.transloadit.dev/file/{workspace} (a literal {workspace} is substituted). The signature does not cover the host, so treat baseUrl as trusted configuration and never derive it from user input. Pass the same baseUrl to parseSmartCdnUrl to parse URLs built with it.

Node usage

import {
  getSignedSmartCdnImageCandidates,
  getSignedSmartCdnUrl,
  signParamsSync,
} from '@transloadit/utils/node'

const signature = signParamsSync(paramsString, authSecret)
const url = getSignedSmartCdnUrl({
  workspace,
  template,
  input,
  authKey,
  authSecret,
})
const imageCandidates = getSignedSmartCdnImageCandidates({
  authKey,
  authSecret,
  // Reuse one absolute expiry across a build instead of recomputing it per request.
  expiresAt,
  // The browser fallback is independent from the Template's input grammar.
  fallbackUrl: '/images/photo.jpg',
  // This workspace Template pins https://example.com/ and accepts a relative path.
  input: 'images/photo.jpg',
  sourceDimensions: { height: 1600, width: 2400 },
  template: 'website-images',
  widths: [320, 640, 960],
  workspace,
})

for (const source of imageCandidates.sources) {
  console.log(source.format, source.quality, source.candidates)
}

API

  • signParams(paramsString, authSecret, algorithm?): WebCrypto-based HMAC signature for params (sha1, sha256, sha384).
  • verifyWebhookSignature({ rawBody, signatureHeader, authSecret }): validates webhook signatures.
  • getSignedSmartCdnUrl(options): async, WebCrypto-based Smart CDN URL signer. Byte-identical to the Node variant below.
  • getSmartCdnUrl(options): unsigned Smart CDN URL builder (same options minus credentials/expiry).
  • parseSmartCdnUrl(url, { baseUrl?, workspace? }): parses a Smart CDN URL into { workspace, template, input, urlParams, auth?, baseUrl? }; throws on anything else.
  • stripSmartCdnAuth(url): removes the signature parameters, byte-for-byte otherwise.
  • baseUrl (option of both builders): trusted replacement for https://{workspace}.tlcdn.com.
  • signParamsSync(paramsString, authSecret, algorithm?): Node-only sync signature helper.
  • getSignedSmartCdnUrl(options) from @transloadit/utils/node: synchronous Smart CDN URL signer.
  • getSignedSmartCdnImageCandidates(options): deterministic structured, signed AVIF and WebP candidates plus an explicit browser fallback. template is mandatory: use a trusted workspace Template that owns its source policy. fallbackUrl is deliberately separate from input, which may use a Template-specific grammar such as a relative origin-pinned path. Supply sourceDimensions to prevent upscaling and keep both output dimensions within backend limits.
  • createSmartCdnImageCandidates(options, sign) from @transloadit/utils: the same deterministic image policy with an injected synchronous signer, for framework and package adapters that own their credential boundary.
  • resolveSmartCdnImageFormats(formats) and resolveSmartCdnImageWidths(widths, maximumWidth?): shared validation and normalization for adapters that use a different image Built-in.
  • getSmartCdnImageLimits(template): the dimension and quality bounds used by the candidate builders. Both builtin/[email protected] and the current @0.0.2 contract are bounded at 4096 px / quality 85; custom Templates retain the default 8000 px / quality 100 contract.