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

@transform-in/sdk

v1.0.2

Published

[![npm version](https://img.shields.io/npm/v/@transform-in/sdk.svg)](https://www.npmjs.com/package/@transform-in/sdk) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Readme

TRANSFORM.IN - JavaScript SDK

npm version License: MIT

The official JavaScript SDK for TRANSFORM.IN - a powerful image and video transformation and optimization service.

📚 Documentation

Features

  • 🖼️ Image transformation (resize, format conversion, quality adjustment)
  • 🎬 Video transformation (currently supporting MP4 output)
  • 🔍 Image information retrieval
  • 🛡️ NSFW content detection
  • 🔄 Asynchronous transformation processing
  • 🌐 URL generation for transformed images and videos

Installation

# Using npm
npm install @transform-in/sdk

# Using yarn
yarn add @transform-in/sdk

# Using pnpm
pnpm add @transform-in/sdk

Usage

Initialize the SDK

import TransformIn from '@transform-in/sdk';

const transformIn = new TransformIn({
  api_key: 'your-api-key',
  project_id: 'your-project-id',
  // Optional: custom base URL
  // base_url: 'https://custom-api.example.com'
});

Check API Health

const health = await transformIn.checkHealth();
console.log(health.status); // 'ok' if the API is healthy

Get Image Information

const info = await transformIn.info('https://example.com/image.jpg');
if (info.success) {
  console.log(info.data);
  // {
  //   base64: 'encoded-url',
  //   url: 'https://example.com/image.jpg',
  //   type: 'image',
  //   ext: 'jpg',
  //   content_type: 'image/jpeg',
  //   width: 1200,
  //   height: 800,
  //   size: 123456
  // }
}

Get NSFW Content Detection

const nsfwInfo = await transformIn.nsfwInfo('https://example.com/image.jpg');
if (nsfwInfo.success) {
  console.log(nsfwInfo.data);
  // {
  //   drawing: 0.01,
  //   hentai: 0.02,
  //   neutral: 0.95,
  //   porn: 0.01,
  //   sexy: 0.01
  // }
}

Generate Transformation URL

const transformationUrl = transformIn.url('https://example.com/image.jpg', {
  w: 300,       // Width
  h: 200,       // Height
  f: 'webp',    // Format
  q: 80,        // Quality (1-100)
  bl: 5         // Blur
});

// Use this URL in your <img> tags or for direct access
console.log(transformationUrl);
// https://api.transform.in.net/transformation/your-project-id/your-api-key/encoded-url/w:300,h:200,f:webp,q:80,bl:5

Prepare Transformation (Background Processing)

// Trigger transformation without waiting for completion
const preparation = await transformIn.prepareTransformation(
  'https://example.com/image.jpg',
  {
    w: 300,
    h: 200,
    f: 'webp',
    q: 80
  }
);

if (preparation.success) {
  console.log(preparation.data.message); // "Transformation is being processed"
}

// Or wait for the transformation to complete
const completedPreparation = await transformIn.prepareTransformation(
  'https://example.com/image.jpg',
  {
    w: 300,
    h: 200,
    f: 'webp',
    q: 80
  },
  true // Set to true to wait for completion
);

if (completedPreparation.success) {
  console.log(completedPreparation.data.message); // "Transformation processed"
}

Generate Video Transformation URL

const videoTransformationUrl = transformIn.url('https://example.com/video.mp4', {
  w: 640,       // Width
  h: 360,       // Height
  f: 'mp4',     // Format (currently only mp4 is supported for video)
  q: 80         // Quality (1-100)
});

// Use this URL in your <video> tags or for direct access
console.log(videoTransformationUrl);
// https://api.transform.in.net/transformation/your-project-id/your-api-key/encoded-url/w:640,h:360,f:mp4,q:80

Prepare Video Transformation

// Video transformations are typically processed asynchronously
const videoPreparation = await transformIn.prepareTransformation(
  'https://example.com/video.mp4',
  {
    w: 640,
    h: 360,
    f: 'mp4',
    q: 80
  }
);

if (videoPreparation.success) {
  console.log(videoPreparation.data.message); // "Transformation is being processed"
}

// For larger videos, it's recommended to use the asynchronous approach
// and check the status later rather than waiting for completion

Transformation Options

| Option | Description | Type | Example | Supported Media | |--------|-------------|------|---------|----------------| | w | Width in pixels | number | w: 300 | Images, Videos | | h | Height in pixels | number | h: 200 | Images, Videos | | f | Output format | string | f: 'webp' | Images: webp, jpg, png, etc.Videos: mp4 | | q | Quality (1-100) | number | q: 80 | Images, Videos | | bl | Blur amount | number | bl: 5 | Images, Videos |

Error Handling

All methods return a response object with a success property that indicates whether the operation was successful. If success is false, the error property will contain details about the error.

try {
  const info = await transformIn.info('invalid-url');
} catch (error) {
  console.error('Error:', error.message);
}

Development

# Install dependencies
npm install

# Run tests
npm test

# Build the SDK
npm run build

License

MIT © TRANSFORM.IN