In-memory file optimization

A high-performance, stateless optimization and minification engine. Condense processes images, audio, video, code, and WebAssembly entirely in-memory using Buffers and Streams — never touching disk.

▩ ~ npm i @studioframes/condense

Built for server-side and serverless workloads

Condense processes uploads and assets in-memory and returns optimized Buffers or Streams — ready to send straight into your response.

No temporary files

Processes files entirely in-memory with Buffers and Streams — no intermediate writes to disk.

Stateless architecture

Optimizations run per-request with no persistent state, making horizontal scaling effortless.

API-friendly

Designed to drop cleanly into HTTP APIs and microservices as Express middleware or an SDK.

Serverless-ready

Works in ephemeral runtimes like Cloud Functions and Lambda where disk access is limited.

High-throughput

Efficient pipelines built to handle high-volume media processing without breaking a sweat.

Low-latency

Tuned to add minimal overhead to your request and response flows.

One engine for every asset

Images, audio, video, markup, code, and WebAssembly — optimized through a single, consistent pipeline.

Media

.png .jpg .jpeg .webp .avif .gif .svg .mp3 .wav .mp4

Web & Code

.html .css .js .ts .jsx .tsx .json .xml .yaml .yml .graphql .less .scss

Run it any way you like

Use Condense as a standalone CLI, a server, mounted Express middleware, or programmatically with the helper SDK.

terminal
# Optimize a single image with extreme compression
npx @studioframes/condense optimize photo.png \
  -o out.webp --method extreme

# Batch optimize a directory (balanced method)
npx @studioframes/condense optimize ./src/ \
  -o ./dist/ --method balanced
terminal
# Start the standalone server
# Defaults to port 3000 — set PORT to override
npx @studioframes/condense

# POST files to http://localhost:3000/optimize
curl -X POST http://localhost:3000/optimize \
  -F "file=@./photo.png;type=image/png" \
  -F "method=balanced" \
  --output photo-condensed.png
server.js
const express = require('express')
const { condenseApp } = require('@studioframes/condense')

const app = express()

// Mount all optimization routes under a path
app.use('/v1', condenseApp)

app.listen(8080, () => {
  console.log('POST files to http://localhost:8080/v1/optimize')
})
optimize.js
const {
  optimizeImage,
  optimizeText,
  optimizeMediaStream,
  optimizeEsbuild,
} = require('@studioframes/condense')

// Optimize an image Buffer (returns a Buffer)
const { buffer, outMime } = await optimizeImage(
  rawImageBuffer,
  'image/png',
  'extreme',
)

// Optimize audio / video (returns a PassThrough Stream)
const { stream } = optimizeMediaStream(rawVideo, 'video/mp4', 'quality')

Three targets, one parameter

Dial in the exact trade-off between fidelity and file size with a single method flag.

Default

Quality

Visually lossless, safe compression that preserves maximum fidelity.

Balanced

The sweet spot between size and quality — mild lossy compression (65% JPEG quality, crf 26 for video).

Extreme

Maximum compression. Converts to modern formats, drops console logs, strips WASM sections, and downscales video.

Real reductions across the sample suite

Results from running the demo suite through the Condense pipeline with each optimization method.

File Original Quality Balanced Extreme Max reduction
styles.scss 1.3 KB 0.3 KB 0.3 KB 0.3 KB -76.2%
demo.png 115.3 KB 98.9 KB 30.2 KB 26.7 KB -76.8%
app.js 5.0 KB 1.8 KB 1.8 KB 1.4 KB -72.5%
component.tsx 2.6 KB 1.8 KB 1.1 KB 1.0 KB -61.0%
service.ts 2.2 KB 1.5 KB 1.0 KB 0.9 KB -58.0%
view.jsx 2.3 KB 1.8 KB 1.2 KB 1.1 KB -52.2%
demo.svg 217.0 KB 119.5 KB 119.3 KB 119.3 KB -45.0%
styles.css 1.0 KB 0.7 KB 0.6 KB 0.6 KB -36.4%
index.html 2.4 KB 1.6 KB 1.6 KB 1.5 KB -35.9%
config.yml 0.9 KB 0.7 KB 0.7 KB 0.6 KB -30.0%
data.json 0.5 KB 0.4 KB 0.4 KB 0.4 KB -25.7%
demo.mp4 30.8 KB 31.6 KB 29.4 KB 25.8 KB -16.4%

Start optimizing in one command

▩ ~ npm i @studioframes/condense