Skip to main content

Usage

The core package exposes an asynchronous function executePipeline() that lets you process a given pipeline schema on an image buffer. It returns an array of saved formats.

function.ts
import { executePipeline } from "@ipp/core";
import { Metadata, Pipeline } fro "@ipp/common";

async function processImage(job: Job) {
const pipeline: Pipeline = [{
pipe: "resize",
options: {
resizeOptions: {
width: 1280
}
}
}];

const source: Buffer = await downloadFromBucket(job);
const result = await executePipeline(pipeline, source);
await uploadToBucket(job, result.formats[0].data.buffer);
}