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

files-sdk-superfiles

v1.0.6

Published

files-sdk adapter for SuperFiles — programmable object storage + Cloudinary-compatible CDN

Readme

files-sdk-superfiles

files-sdk adapter for SuperFiles — programmable object storage with a Cloudinary-compatible on-the-fly image CDN.

npm license

Install

npm install files-sdk-superfiles
# files-sdk is optional — only needed if you use the adapter
npm install files-sdk

Quick start

Standalone URL utilities (no files-sdk needed)

import { buildUrl, buildSrcSet } from "files-sdk-superfiles";

// Basic CDN URL
buildUrl("https://files.montr.online", "media", "photos/hero.jpg")
// → "https://files.montr.online/cdn/media/photos/hero.jpg"

// With transforms — params are sorted alphabetically for cache consistency
buildUrl("https://files.montr.online", "media", "photos/hero.jpg", { w: 800, f: "auto", q: 80 })
// → "https://files.montr.online/cdn/media/f_auto,q_80,w_800/photos/hero.jpg"

// Responsive srcset
buildSrcSet("https://files.montr.online", "media", "hero.jpg", [400, 800, 1200], { f: "auto" })
// → "https://…/cdn/media/f_auto,w_400/hero.jpg 400w, …/f_auto,w_800/hero.jpg 800w, …"

files-sdk adapter

import { Files } from "files-sdk";
import { superfiles } from "files-sdk-superfiles";

const files = new Files({
  adapter: superfiles({
    url: "https://files.montr.online",
    token: "sf_live_...",
    bucket: "media",
  }),
});

// Standard files-sdk methods
await files.upload("photos/hero.jpg", readStream);
await files.download("photos/hero.jpg");
files.url("photos/hero.jpg");
// → "https://files.montr.online/cdn/media/photos/hero.jpg"

// Transform URL via raw escape hatch
import type { SuperFilesRawClient } from "files-sdk-superfiles";
const sf = files.raw as SuperFilesRawClient;
sf.transformUrl("photos/hero.jpg", { w: 800, f: "auto" });
// → "https://files.montr.online/cdn/media/f_auto,w_800/photos/hero.jpg"

const signed = await sf.signedUpload("uploads/hero.jpg", { contentType: "image/jpeg" });
// { signedUrl, expiresAt, method: "PUT", headers: { "Content-Type": "image/jpeg" } }

All JSON responses are runtime-validated with the same @superfiles/types Zod contracts used by the API and OpenAPI specification. A malformed successful response throws instead of returning partially undefined data.

Transform parameters

| Param | Type | Default | Description | |---|---|---|---| | w | number (1–8000) | original | Output width in pixels | | h | number (1–8000) | original | Output height in pixels | | c | contain·cover·fill·crop | contain | Crop/fit mode when both w and h are set | | ar | string e.g. "16:9" | — | Derives missing dimension from aspect ratio | | f | jpg·png·webp·avif·gif·auto | original | Output format. auto = best format from Accept header | | q | number (1–100) | 85 | Quality for lossy formats (JPEG, WebP, AVIF) | | t | number (seconds) | 0 | Video frame timestamp (thumbnail extraction) |

Next.js image loader

// superfiles-loader.ts (in your project root)
import superFilesLoader from "files-sdk-superfiles/next";
export default superFilesLoader;
// next.config.js
module.exports = { images: { loaderFile: "./superfiles-loader.ts" } }
// Usage in JSX — width and quality are forwarded as w and q transforms
<Image src="products/hero.jpg" width={800} height={600} alt="Hero" />
// → https://files.montr.online/cdn/media/f_auto,q_85,w_800/products/hero.jpg

Required env vars:

NEXT_PUBLIC_SUPERFILES_URL=https://files.montr.online
NEXT_PUBLIC_SUPERFILES_BUCKET=media

React hook

import { useImageUrl, useSrcSet } from "files-sdk-superfiles/react";

const src = useImageUrl("products/hero.jpg", { w: 800, f: "auto" });
// → "https://files.montr.online/cdn/media/f_auto,w_800/products/hero.jpg"

const srcSet = useSrcSet("hero.jpg", [400, 800, 1200], { f: "auto" });
// → "…/f_auto,w_400/hero.jpg 400w, …/f_auto,w_800/hero.jpg 800w, …"

Pass opts.baseUrl / opts.bucket to override env vars in multi-bucket apps:

const src = useImageUrl("avatar.jpg", { w: 64 }, { bucket: "avatars" });

Exports

files-sdk-superfiles          → buildUrl, buildSrcSet, normaliseTransform, superfiles adapter
                                 SuperFilesTransformOptions, SuperFilesRawClient types
files-sdk-superfiles/next     → superFilesLoader (default export), SuperFilesImageLoaderProps
files-sdk-superfiles/react    → useImageUrl, useSrcSet

files.signedUploadUrl() follows the files-sdk v2 contract and returns { method, url, headers? }. Use files.raw.signedUpload() when you also need Superfiles-specific expiry metadata.

License

MIT