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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@filejet/sdk

v1.0.0

Published

Filejet SDK.

Readme

Filejet SDK

Filejet SDK

Installation

yarn add @filejet/sdk

Utils

Generate <img / > attributes:

To generate the correct src and srcSet attributes for the <img /> tag, you can use the filejetImg function.

It will return urls with the correct mutations to fit your requirements.

import { filejetImg } from '@filejet/sdk/utils';

const attributes = filejetImg({
  src: 'https://myapp.com/image.jpg', // Either URL or file ID.
  width: 128,
  height: 128,
  dpiScale: [1, 1.5, 2],
  fit: 'cover',
  backgroundColor: 'transparent',
  filejetDomain: 'cdn.myapp.com',
});

// {
//   src: '...',
//   srcSet: '...',
//   width: 128,
//   height: 128
// }
}
console.log(attributes);

React

To use the Filejet integration, you need to initialize the Filejet and provide it through the <FilejetProvider />.

import { Filejet, FilejetProvider, LruCache } from '@filejet/sdk/react';

const filejet = new Filejet({
  domain: 'cdn.app.com',
  Img: {
    dpiScale: [1, 1.5, 2],
    placeholderNode: <div style={{ background: '#eeeded', width: '100%', height: '100%' }}></div>,
    errorNode: (
      <div
        style={{
          width: '100%',
          height: '100%',
          display: 'flex',
          justifyContent: 'center',
          alignItems: 'center',
          flexDirection: 'column',
          backgroundColor: `rgba(255,255,255, 0.4)`
        }}
      >
        <WarningIcon color="primary" />
        Failed to load
      </div>
    )
  },
  ThumbhashImg: {
    cache: new LruCache({ maxSize: 512 }),
    intersectRootMargin: 100
  }
});

ReactDOM.render(
  <FilejetProvider filejet={filejet}>
    <App />
  </FilejetProvider>,
  document.getElementById('root')
);

Img component

<Img> component will render the image in the most optimized way.

src property can be either a filejet ID or HTTPs URL to external file.

import { Img } from '@filejet/sdk/react';

<Img
  src="KRhBC0tycdeENyP1PQkgBA"
  thumbhash="HBkSHYSIeHiPiHh8eJd4eTN0EEQG"
  height={168}
  fit="cover"
  alt="Photo"
/>;

Recommended usage:

It is recommended to alway use thumbhash in a combination with height to ensure dimensions are known before the image is loaded to prevent layout shift.

Thumbhash encodes both the blurred placeholder and its ratio, so client can avoid layout shifts even when the ratio is not known as it can be calculated from the thumbhash.

Rendering process: Image starts with the single-color placeholder calculated from the average color of thumbhash. Then, when the image is in the viewport, the original image is fetched (scaled based on DPI). If the image is in browser's cache, it is rendered immediately. If not, the blurred placeholder is rendered until the image is loaded.

Rendering priority: priority prop can be used to prioritize the image fetching, decoding and blurred placeholder rendering. Recommended value is auto (default). Using low will lead into longer time between the single-color placeholder and the real image.