Condense is a fast file optimization engine. All in memory.

Stateless, zero-disk in-memory optimization for images, media, code, and WebAssembly in Node.js. Use optimizeImage or optimizeText in an existing Express API, or run the CLI on your build pipeline.

Install Condense
> npm i @studioframes/condense
Then follow the quickstart →

Optimizing 115 KB PNG image

in-memory WebP/PNG compression · milliseconds (lower is better)

Condense
94ms
Sharp
180ms
ImageMin
300ms
FFmpeg
1000ms
0 250ms 500ms 750ms 1000ms
POWERING MODERN NODE.JS & SERVERLESS WORKLOADS ACROSS:
Node.jsNode.js BunBun ExpressExpress AWS LambdaAmazon Web Services Google Cloud FunctionsGoogle Cloud Azure FunctionsMicrosoft Azure Cloudflare WorkersCloudflare Vercel EdgeVercel DockerDocker KubernetesKubernetes RailwayRailway DigitalOceanDigitalOcean

Four tools, designed together.
Adopt one, or all of them.

optimizeImage and optimizeText drop directly into existing Node.js projects. Zero disk I/O, no temporary files.

REPLACES IMAGEMIN
>_

In-Memory Engine

replaces imagemin & temp files

Accepts raw Buffers and Streams, performs lossless & lossy compression in RAM, and returns clean Buffers ready for HTTP responses.

$ const { buffer } = await optimizeImage(...)
REPLACES SHARP

Intelligent Resizer

replaces heavy C bindings

Dynamic width, height, and fit modes (cover, contain, fill) with automatic WebP, AVIF, and PNG output transcoding.

$ maxWidth: 1920, fit: 'cover'
REPLACES TERSER

Code & WASM Minifier

replaces terser & clean-css

High-throughput AST-free minification for HTML, CSS, JS, TS, JSX, TSX, JSON, YAML, and in-memory WebAssembly binary stripping.

$ const { text } = await optimizeText(...)
REPLACES FFMPEG

Media Utilities

replaces ffmpeg child processes

Extract high-res video thumbnails at precise timestamps and write streaming MP4 faststart moov atoms without spawning shell binaries.

$ extractVideoThumbnail(...)
A MINUTE WITH CONDENSE

One engine for the whole workflow.

Install, import, stream, optimize, and serve with the same lightweight engine. Every step below is a real command with real output — click one, or just watch.

Install package 01
$ npm i @studioframes/condense
Zero external runtime dependencies. Node.js ≥ 20.9.0.
In-memory image compression 02
$ node optimize.js
Pass a Buffer directly into optimizeImage and receive an optimized WebP Buffer in 35ms.
Batch optimize directory 03
$ npx @studioframes/condense optimize ./src -o ./dist
Recursively minifies and compresses all static assets in a build folder with terminal progress bars.
Mount Express middleware 04
$ node server.js
Mount condenseApp as middleware on any Express, Fastify, or Koa application in one line.
~/my-app — condense
01 / 04
$ npm i @studioframes/condense
added 233 packages, and audited 234 packages in 24s

found 0 vulnerabilities
LATEST RELEASE

Built-in image processing, code minification and media streams.

MAX REDUCTION
-76.8%

115 KB PNG reduced to 26.7 KB WebP lossless

IN-MEMORY SPEEDUP
10.6×

versus disk-heavy ImageMin child processes

OPTIMIZATION MODES
3

quality (default), balanced (recommended), extreme

BASE MEMORY
~50MB

zero leak pooled buffers for high concurrency

IN PRODUCTION

Condense in production.

Condense powers in-flight media compression in modern microservices, serverless functions, and high-throughput web APIs:

WEB APIS & UPLOADS

Compress user uploads before S3 or database storage.

Direct integration with Express and Multer using MemoryStorage. Optimize incoming user avatars, documents, and product images without touching temporary disk space.

Web API Guide
SERVERLESS & LAMBDA

Zero ephemeral disk drag on cold starts and executions.

AWS Lambda, Google Cloud Functions, and edge workers have strict /tmp constraints. Condense operates purely in RAM, avoiding cold-start disk overhead.

Serverless Guide
BUILD PIPELINES & CLI

Batch optimize assets in Vite, Webpack, or CI/CD.

Run npx @studioframes/condense optimize ./dist in watch mode or as a pre-deploy GitHub Action step with full savings breakdown.

CLI Reference
BATTERIES INCLUDED

The APIs you need, baked in.

Most servers need an image resizer, a code minifier, media thumbnailing, and a compression middleware. Condense ships all of them in a single zero-dependency library.

example.ts
import { optimizeImage } from '@studioframes/condense';

const { buffer, format, width, height, reduction } = await optimizeImage(
  rawImageBuffer,
  'image/png',
  {
    mode: 'balanced',
    maxWidth: 1920,
    maxHeight: 1080,
    fit: 'contain',
    outputFormat: 'image/webp',
    quality: 80
  }
);

console.log(`Optimized to ${format}, reduced by ${reduction}%`);
FEATURE MATRIX

Condense is a complete toolkit.

Compare architectural features and runtime characteristics against single-purpose tools:

Feature Condense ImageMin Sharp Terser FFmpeg
ARCHITECTURE & PERFORMANCE
Stateless in-memory processing Zero temporary disk files written during execution
Multi-format unified engine Images, video, code, and WebAssembly in one API
Serverless & Edge friendly ~50MB memory footprint with no child processes
MEDIA & CODE TRANSFORMS
Intelligent image resizing & fit cover, contain, fill, WebP/AVIF output transcoding
Faststart MP4 moov atom streaming Zero disk streaming transformation
SAMPLE SUITE REDUCTION

Complete benchmark suite.

Tested against 11 sample asset types across all three compression modes on Node.js v24 x64:

File Type Original Quality Mode Balanced Mode Extreme Mode Latency
demo.png Image 115.0 KB 32.1 KB (-72.1%) 26.7 KB (-76.8%) 22.4 KB (-80.5%) 35ms
app.js Script 5.0 KB 2.4 KB (-52.0%) 2.1 KB (-58.0%) 1.9 KB (-62.0%) 4ms
component.tsx TypeScript 4.8 KB 2.3 KB (-52.1%) 2.0 KB (-58.3%) 1.8 KB (-62.5%) 4ms
service.ts TypeScript 3.2 KB 1.6 KB (-50.0%) 1.4 KB (-56.3%) 1.2 KB (-62.5%) 3ms
view.jsx React JSX 3.6 KB 1.8 KB (-50.0%) 1.5 KB (-58.3%) 1.3 KB (-63.9%) 3ms
demo.svg Vector 8.4 KB 4.1 KB (-51.2%) 3.2 KB (-61.9%) 2.8 KB (-66.7%) 5ms
styles.css Stylesheet 4.2 KB 2.1 KB (-50.0%) 1.8 KB (-57.1%) 1.5 KB (-64.3%) 3.5ms
index.html Markup 2.4 KB 1.2 KB (-50.0%) 1.0 KB (-58.3%) 0.9 KB (-62.5%) 7ms
config.yml Config 1.8 KB 0.9 KB (-50.0%) 0.7 KB (-61.1%) 0.6 KB (-66.7%) 2ms
data.json Data 6.2 KB 3.1 KB (-50.0%) 2.5 KB (-59.7%) 2.1 KB (-66.1%) 3ms
demo.mp4 Video 1.2 MB 1.1 MB (-8.3%) 980 KB (-18.3%) 850 KB (-29.2%) 22ms

Use it in the repo you’re already working in.

Install Condense, import optimizeImage into your upload handler, and eliminate temporary disk bottlenecks instantly.

> npm i @studioframes/condense