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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dislify/sdk

v0.23.3

Published

Official TypeScript SDK for PDF tools, document conversion, spreadsheets, OCR, image, audio and video processing, and batch file operations.

Readme

@dislify/sdk

Official server-side JavaScript/TypeScript SDK for Dislify Files, file processing, document conversion, and media compression.

Installation

npm install @dislify/sdk

Requires Node.js 20+ and a Dislify API key from Developer settings. API access is subject to your Dislify plan.

Use the SDK in trusted server-side applications, including Next.js server routes, Node.js services, scripts, and background jobs. Keep your DISLIFY_API_KEY private and never expose it in browser bundles.

File-processing quickstart

import { readFile, writeFile } from "node:fs/promises"
import { DislifyClient } from "@dislify/sdk"
const client = new DislifyClient({ apiKey: process.env.DISLIFY_API_KEY! })
const source = await client.files.upload(new Blob([new Uint8Array(await readFile("proposal.docx"))]), {
  fileName: "proposal.docx",
  contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
})
const submission = await client.files.convert(source.id, { format: "pdf" })
const job = await client.processing.wait(submission.id, {
  onProgress: job => console.log(job.status, job.processingStage),
})
for (const output of job.generatedFiles) {
  const blob = await client.files.download(output.id)
  await writeFile(output.name, Buffer.from(await blob.arrayBuffer()))
}
console.log((await client.files.get(job.generatedFiles[0].id)).parents)

All helpers submit to /api/v1/processing/jobs using the same Bearer token, quota and ownership rules. files.upload prepares a signed direct upload and finalizes a retained source. files.list, files.get and files.download reuse the private Files model; downloads never forward the Bearer token to object storage.

Core Files and conversion helpers

| Operation | SDK call | Inputs / output | Important options | |---|---|---|---| | office_to_pdf | client.files.convert(ids, {format:"pdf"}) | DOCX/XLSX/PPTX → one PDF per input | Ordered mixed Office batch; wait each returned job ID | | images_to_pdf | client.files.convert(ids, {format:"pdf",operation:"images_to_pdf"}) | Ordered JPG/PNG → one PDF | Input order becomes page order | | merge_pdf | client.processing.mergePdf(["pdf-a","pdf-b"]) | Two or more ordered PDFs → one PDF | No configuration | | split_pdf | client.processing.splitPdf(id, {mode:"extract",pages:"1,3,5-8"}) | One PDF → PDF(s) | Also {mode:"ranges",ranges:["1-3","4-6"]} or {mode:"every_page"} | | organize_pdf | client.processing.organizePdf(id, {pages:[{page:4,rotation:90},{page:1,rotation:0}]}) | Source page plan → one PDF | One-based pages; clockwise 0/90/180/270; no duplicates | | pdf_to_images | client.processing.pdfToImages(id, {format:"png",pages:[1,3]}) | PDF → JPG/PNG per page | jpg or png; server sorts pages into source order | | compress_image | client.processing.compressImage(id, {targetSizeBytes:1024**2}) | JPG/PNG → smaller JPG or alpha PNG | maximum bytes or preset; transparency preserved, metadata removed | | compress_pdf | client.processing.compressPdf(id, {preset:"balanced"}) | PDF → smaller PDF | exactly one of targetSizeBytes or best_quality / balanced / smaller_file; unreachable/no-savings is error with no output | | csv_to_xlsx | client.processing.csvToXlsx(id, {delimiter:"auto",idempotencyKey:"csv-1"}) | UTF-8 CSV → literal-text XLSX | auto / comma / semicolon / tab / pipe | | xlsx_to_csv | client.processing.xlsxToCsv(id, {sheet:"Sales",delimiter:"comma",idempotencyKey:"sheet-1"}) | XLSX sheet → UTF-8 BOM CSV | Exact worksheet name; comma / semicolon / tab / pipe | | heic_to_image | client.processing.heicToImage(id, {format:"jpg",idempotencyKey:"photo-1"}) | HEIC/HEIF → JPG/PNG | SDR primary still; source unchanged, private metadata stripped |

SDK methods

The SDK provides the following methods. Availability may vary by installed version and Dislify plan; each operation enforces its own format, page, size, and ownership limits.

| Area | Client methods | |---|---| | Files | files.upload, list, get, download, convert, worksheets, media, trimMedia | | PDF editing | processing.mergePdf, splitPdf, organizePdf, pdfToImages, compressPdf, watermarkPdf, addPdfPageNumbers, removePdfMetadata | | PDF analysis | processing.comparePdfs, inspectPdfImages, extractPdfImages, inspectPdfForWord, pdfToWord, previewPdfExcel, pdfToExcel, inspectPdfTables, extractPdfTables, previewPdfTableExport | | PDF protection and repair | processing.protectPdf, detectBlankPdfPages, removeBlankPdfPages, previewPdfScan, cleanPdfScan | | Spreadsheets | processing.csvToXlsx, xlsxToCsv, inspectSpreadsheet, previewSpreadsheetMerge, mergeSpreadsheets, previewSpreadsheetCleanup, cleanSpreadsheet, previewSpreadsheetSplit, splitSpreadsheet, renameFiles | | Images and OCR | processing.compressImage, resizeImage, convertImage, cropRotateImage, watermarkImage, stripImageMetadata, removeBackground, heicToImage, extractText, ocrPdf, imageToSearchablePdf | | Audio and video | processing.videoToMp3, extractAudio, trimVideo, trimAudio, convertAudio, convertVideo, videoToHls, hlsManifest | | Jobs and workflows | processing.batch, get, wait, waitBatch, downloadZip; workflows.create, list, get, update, delete, run, getRun, listRuns, retry, wait, downloadZip |

The package root also exports TypeScript types and operation validators for PDF, spreadsheet, scan cleanup, image, audio/video, and workflow operations. Import from @dislify/sdk, not an internal module path. See the detailed sections below for request shapes and restrictions.

Use client.files.worksheets(id) to inspect XLSX sheet names/order/visibility/bounds. Omit sheet only for exactly one visible worksheet; hidden sheets need an explicit name. Formula caches are exported without evaluation; missing caches fail and dangerous CSV text is safely prefixed.

ConvertToPdfOptions, MergePdfOptions, SplitPdfOptions, OrganizePdfOptions, PdfToImagesOptions, CompressPdfOptions, CsvToXlsxOptions, XlsxToCsvOptions, HeicToImageOptions, ProcessingOperationRequest and WaitForProcessingOptions are exported. Every submission helper accepts signal; processing.get(id,{signal}) and processing.wait(id,{signal,pollIntervalMs,timeoutMs,onProgress}) support cancellation. processing.wait returns a completed job, throws DislifyJobError with jobId on native failure and DislifyTimeoutError on poll timeout.

Sources remain unchanged. Split/PDF-to-images create multiple normal generatedFiles; Office batches return independent jobIds and a nullable batchId. generatedByJobId and File parents/descendants retain lineage. Durable does not mean permanent: plan/bucket retention and storage quotas apply. See https://dislify.com/developers/api#processing for byte, pixel, page and output limits.

Uncertain processing/upload POSTs are not automatically retried. CSV-to-XLSX, XLSX-to-CSV, HEIC, PDF compression and image compression submissions currently implement Idempotency-Key; reusing a key with different source/options is rejected. A generic job may be accepted with status error when dispatch fails.

Generic job webhooks

Register the existing job.queued, job.completed, job.failed events in the developer dashboard or public webhook API. The payload {id,type,createdAt,data} includes public operations/options, job/source IDs and generated File IDs, names, MIME types and sizes. PDF image outputs add page/format/dimensions; failures include safe errors. Verify X-Dislify-Signature: t=timestamp,v1=hex as HMAC-SHA256 of ${timestamp}.${rawBody}; check timestamp freshness and compare securely. Deduplicate the payload event ID (X-Dislify-Event-Id); X-Dislify-Webhook-Id identifies the endpoint.

Delivery is best effort, with event filtering, enabled endpoints, a 10-second timeout and stored counters/last status. Automatic webhook retries, durable delivery history and replay are not implemented. Guest jobs have no account webhook endpoints. These are separate from SDK HTTP retry behavior.

Existing media-compression API

import { readFile } from "node:fs/promises"
import { DislifyClient } from "@dislify/sdk"

const dislify = new DislifyClient({
  apiKey: process.env.DISLIFY_API_KEY!,
})

const source = new Blob([await readFile("./hero.png")], {
  type: "image/png",
})

const job = await dislify.optimizeImage(source, {
  fileName: "hero.png",
  compression: "balanced",
  onProgress(job) {
    console.log(`${job.progress}%`)
  },
})

console.log(job.id)
console.log(job.status)
console.log(job.outputSize)
console.log(job.shareUrl)

const optimized = await dislify.download(job.id)

optimizeImage() creates the image job and waits for it to finish before returning the completed job.

Save the optimized file

import { writeFile } from "node:fs/promises"

const optimized = await dislify.download(job.id)

await writeFile(
  "./optimized-hero.png",
  Buffer.from(await optimized.arrayBuffer())
)

Custom output target

const job = await dislify.optimizeImage(source, {
  fileName: "hero.png",
  compression: "custom",
  targetSizePercent: 55,
})

Create now, wait later

const created = await dislify.createImageJob(source, {
  fileName: "hero.png",
  compression: "balanced",
})

const finished = await dislify.waitForJob(created.id, {
  onProgress(job) {
    console.log(job.status, job.progress)
  },
})

Process a media batch

createBatch() supports image, video, and audio files.

import { readFile } from "node:fs/promises"

const files = await Promise.all([
  readFile("./hero.png"),
  readFile("./trailer.mp4"),
])

const batch = await dislify.createBatch(
  [
    {
      input: new Blob([files[0]], { type: "image/png" }),
      fileName: "hero.png",
      compression: "web",
    },
    {
      input: new Blob([files[1]], { type: "video/mp4" }),
      fileName: "trailer.mp4",
      compression: "custom",
      targetSizePercent: 65,
    },
  ],
  { name: "Launch media" }
)

const report = await dislify.waitForBatch(batch.id, {
  onProgress(batch) {
    console.log(`${batch.completedCount}/${batch.totalCount}`)
  },
})

Batch upload concurrency

Batch uploads are concurrency-limited internally. The default is four simultaneous uploads.

const dislify = new DislifyClient({
  apiKey: process.env.DISLIFY_API_KEY!,
  uploadConcurrency: 4,
})

Webhooks

await dislify.createImageJob(source, {
  fileName: "hero.png",
  compression: "balanced",
  webhookUrl: "https://example.com/webhooks/dislify",
})

Download a completed job

const file = await dislify.download(job.id)
const bytes = await file.arrayBuffer()

Progress callbacks

Both jobs and batches support progress callbacks.

const job = await dislify.optimizeImage(source, {
  fileName: "hero.png",
  onProgress(job) {
    console.log(job.status, job.progress)
  },
})

Errors

import {
  DislifyApiError,
  DislifyJobError,
  DislifyTimeoutError,
} from "@dislify/sdk"

try {
  await dislify.optimizeImage(source, {
    fileName: "hero.png",
  })
} catch (error) {
  if (error instanceof DislifyApiError) {
    console.error(error.status, error.message)
  } else if (error instanceof DislifyJobError) {
    console.error(error.jobId, error.message)
  } else if (error instanceof DislifyTimeoutError) {
    console.error("Dislify timed out")
  } else {
    throw error
  }
}

Client configuration

const dislify = new DislifyClient({
  apiKey: process.env.DISLIFY_API_KEY!,
  uploadConcurrency: 4,
  timeoutMs: 30_000,
  retries: 2,
})

Server-side usage

@dislify/sdk is designed for trusted server-side JavaScript and TypeScript, including Node.js applications, Next.js Route Handlers and Server Actions, Express, Fastify, Discord bots, CLI tools, background workers, and automation services.

Do not initialize the SDK with a private API key inside browser-side code.

Requirements

  • Node.js 20 or newer
  • A Dislify account
  • A valid Dislify API key
  • API access on an eligible Dislify plan

Notes

  • API access currently requires the Dislify Unlimited plan.
  • Create and manage API keys at https://dislify.com/dashboard/developers
  • Full API documentation is available at https://dislify.com/developers/api
  • optimizeImage() and createImageJob() are image-specific helpers.
  • createBatch() accepts image, video, and audio inputs.
  • Batch uploads are concurrency-limited automatically.
  • Keep API keys on trusted server-side code.
  • Never expose a Dislify API key in browser bundles or client-side environment variables.

Links

  • Dislify: https://dislify.com
  • Developer dashboard: https://dislify.com/dashboard/developers
  • API documentation: https://dislify.com/developers/api

License

MIT

Exact byte targets

const submitted = await client.processing.compressPdf(source.id, {
  targetSizeBytes: 2 * 1024 ** 2,
  idempotencyKey: "pdf-limit-1",
})
const result = await client.processing.wait(submitted.id)
// Success: result.generatedFiles[0].size <= 2 * 1024 ** 2.
// JPG/PNG: client.processing.compressImage(id, { targetSizeBytes: 512 * 1024 }).

CompressionSizeOptions, CompressPdfOptions and CompressImageOptions enforce preset/target exclusivity. Runtime validation rejects ambiguous, fractional and invalid targets before HTTP. Targets are integers of at least 16 KB, between 5% and 95% of the source and within plan/output limits (PDF 250 MB; images 50 MB). 1 MB is 1,048,576 bytes. Native safety floors can make a target unreachable; wait reports the failed job, with no output File/storage charge. Try a larger target or a preset. Stored output bytes are independently verified before success. JPEG quality stops at 70 with at most 25% dimension reduction; transparent PNG stops at 128 colors and at most 25% width reduction. PDF retains text/vectors, with embedded raster quality no lower than 70 and longest edge no lower than 1280 for images above that size. Originals remain unchanged.

Generic lifecycle events carry operations[].targetSizeBytes or preset, source IDs, and actual generated-file sizes. No compression-specific event family is introduced. Never treat queued acceptance as target success.

Independent processing batches

const batch = await client.processing.batch({
  fileIds: [firstFile.id, secondFile.id],
  operation: { type: "compress_pdf", preset: "balanced" },
  idempotencyKey: crypto.randomUUID(),
})
const results = await client.processing.waitBatch(batch, { timeoutMs: 120_000 })
const failed = results.jobs.filter((job) => job.status === "error")
if (failed.length) {
  const retry = await client.processing.batch({
    fileIds: failed.map((job) => job.sourceFileIds![0]),
    retryJobIds: failed.map((job) => job.id),
    operation: { type: "compress_pdf", preset: "balanced" },
    idempotencyKey: crypto.randomUUID(),
  })
  const retried = await client.processing.waitBatch(retry)
  // Retain earlier successful outputs; retry adds only failed item attempts.
}
const outputs = results.jobs.flatMap((job) => job.status === "done" ? job.generatedFiles.map((file) => file.id) : [])
if (outputs.length) {
  const zip = await client.processing.downloadZip(outputs) // private Blob, ≤50 MB combined
}

Many supported one-source processing operations use independent batches; the original six-operation list from the earlier milestone is no longer exhaustive. Combined-document and multi-output tools retain their existing helpers. Normal plan/storage/API quotas apply per queued child; errors retain partial successful Files. POST output ZIP accepts owned generated File IDs only, with 1–100 outputs/50 MB. Check the npm registry version before installing these helpers.

English OCR and searchable PDFs

const accepted = await client.processing.ocrPdf(pdfFileId, { language: "eng", idempotencyKey: "ocr-report" })
const result = await client.processing.wait(accepted.id)
const image = await client.processing.imageToSearchablePdf(pngFileId, { idempotencyKey: "ocr-image" })
const batch = await client.processing.batch({
  fileIds: [firstPdfId, secondPdfId],
  operation: { type: "ocr_pdf", language: "eng" },
  idempotencyKey: "ocr-batch",
})
const completed = await client.processing.waitBatch(batch)
const zip = await client.processing.downloadZip(completed.jobs.flatMap(job => job.generatedFiles.map(file => file.id)))

English (eng) only, local/self-hosted recognition. Source 20 MiB/output 50 MiB; PDF pages Free 3, Pro 10, Unlimited 20; batch source counts 1/10/20 and total pages 3/30/60. JPG/PNG still images only. Outputs preserve original PDF visuals with an invisible selectable text layer; existing meaningful text pages are skipped. Blank/unrecognized pages remain safe. signal and idempotencyKey are supported. Internal verified page snapshots and recognized text are never exposed as job options/webhook data. Text extraction is also supported separately through processing.extractText. Server admission requires a ready OCR consumer. See the repository's docs/OCR_SEARCHABLE_PDF.md for full limits and heuristics. Check the npm registry version before using these helpers.

Reusable workflows

const { workflow } = await client.workflows.create({
  name: "Prepare client PDF",
  steps: [{ type: "office_to_pdf" }, { type: "compress_pdf", targetSizeBytes: 2 * 1024 ** 2 }],
})
const { workflowRunId } = await client.workflows.run(workflow.id, {
  fileIds: [fileId], idempotencyKey: "client-pdf-2026-10-10",
})
const result = await client.workflows.wait(workflowRunId, { signal, timeoutMs: 600_000 })
// Partial/failed runs retain successful outputs; inspect item.error before retry.
const failed = result.items.find(item => item.status === "failed")
if (failed) {
  const attempt = failed.attempts.filter(a => a.stepIndex === failed.stepIndex).at(-1)!
  await client.workflows.retry(result.id, failed.id, attempt.id)
}

Use list, get, update(id, fields, {version}), delete, listRuns, getRun and downloadZip. Definitions are bounded to five compatible one-input/one-output operations; unknown worker options are rejected. Every step/retry uses its usual plan/storage/API quota. downloadZip includes final successful Files only, capped by the shared ZIP policy. Deleted definitions preserve immutable run snapshots/history. See docs/WORKFLOWS.md in the source repository. No schedules, branching or arbitrary HTTP/code.

Extract text

const accepted = await client.processing.extractText(fileId, {
  language: "eng", idempotencyKey: "extract-report-v1",
})
const job = await client.processing.wait(accepted.id)
const txt = await client.files.download(job.generatedFiles[0].id)

PDF/JPG/PNG → durable UTF-8 TXT (2 MiB max). PDFs reuse meaningful existing text, otherwise local English OCR. LF/no BOM; form-feed separates pages; blank pages contain LF. Shared batch/failure-only retry/ZIP and terminal workflows are supported. Public Jobs/events contain File metadata, never extracted text. Download the File to read it. Source/plan/OCR limits and rollout: docs/TEXT_EXTRACTION.md. No npm publication is performed.

Resize image

const { id } = await client.processing.resizeImage(file.id, { width: 1200, idempotencyKey: "resize-photo" });
const result = await client.processing.wait(id);

Use width, height, both as a fit-inside bounding box, or integer percent (1–400) alone. Dimensions are whole pixels (1–8192). Orientation is applied before sizing; half-pixels round up. Aspect ratio is preserved without cropping. JPG/JPEG returns JPG; PNG returns PNG with transparency. Color profiles normalize to sRGB; EXIF/GPS/XMP and other metadata are stripped. No-op dimensions return “The image is already at the requested size.” without a generated File. Upscaling may increase bytes; output caps remain 50 MiB and plan limits, 20M pixels and 8192 per side. Original Files remain immutable. signal is supported. Independent batch and workflow operations accept { type: "resize_image", percent: 50 } and share retry/ZIP/lineage. No format, crop, stretch, DPI or target-byte options.

Still-image format conversion

const accepted = await client.processing.convertImage(fileId, {
  format: "webp",
  idempotencyKey: "hero-webp-v1",
})
const completed = await client.processing.wait(accepted.id)
await client.processing.batch({
  fileIds,
  operation: { type: "convert_image", format: "jpg" },
  idempotencyKey: "convert-batch-v1",
})

JPG, PNG and WebP sources must be still images and the destination must differ. PNG sources above 8 bits per channel are rejected to avoid silently reducing color precision. Dimensions remain unchanged after EXIF orientation. JPG flattens alpha on white at quality 95; PNG preserves alpha losslessly; PNG/transparent sources use lossless WebP, opaque JPG uses WebP quality 95. Output may grow. The 50 MiB source/output, 8192px and 20M-pixel limits and plan caps apply. Alpha and metadata handling are documented in docs/IMAGE_FORMAT_CONVERSION.md. This functionality is included in repository version 0.23.0.

Remove image metadata

const accepted = await client.processing.stripImageMetadata(fileId, {
  idempotencyKey: "clean-photo-v1",
})
const done = await client.processing.wait(accepted.id)
await client.processing.batch({
  fileIds,
  operation: { type: "strip_image_metadata" },
  idempotencyKey: "clean-batch-v1",
})

Still JPG/JPEG, PNG and WebP produce a sanitized File in the same canonical format. Orientation is applied to pixels; valid bounded profiles normalize to sRGB; EXIF/GPS/XMP/comments/profile bytes are removed. Transparency is preserved. JPG is lossy re-encoded; outputs may grow. Originals stay immutable. Existing batch/retry/ZIP, workflow, ownership, API quota and signed event rules apply. Metadata support originated in the 0.12.0 source milestone and is included in repository version 0.23.0.

Remove a background

const created = await client.processing.removeBackground(fileId, {
  idempotencyKey: "remove-bg-v1",
});
// Shared batch input operation: { type: "remove_background" }

Still JPG/PNG/WebP input; new transparent-capable RGBA PNG output at oriented source dimensions. Existing plan limits apply, with an operation-specific 12-million-pixel ceiling. Inference is local to Dislify workers. Model/runtime readiness is required; results around hair, glass and complex edges can vary. No model selection or tuning options are accepted. See docs/REMOVE_BACKGROUND.md.

PDF text watermark

const job = await client.processing.watermarkPdf(file.id, {
  mode: "text", text: "CONFIDENTIAL", fontSize: 36, opacity: 0.2,
  rotation: 45, color: "#294B3D", position: "center", pages: [],
  idempotencyKey: "watermark-1",
})
const result = await client.processing.wait(job.id)

Printable ASCII only (embedded Bitstream Vera); points for size, degrees for rotation, 0.05–0.6 alpha, one-based unique pages (empty/omitted means all). One source produces one new PDF, preserving the original. Standard batch/retry/ZIP and PDF→PDF workflows use the same operation. Logo mode, signed/encrypted/forms/active PDFs are unsupported. A watermark is a visible overlay, not redaction or DRM.

PDF page numbers

const job = await client.processing.addPdfPageNumbers(file.id, {
  format: "page_number_of_total", position: "bottom_center", startNumber: 7,
  pages: [2, 4, 5], fontSize: 12, color: "#294B3D", opacity: 1, margin: 24,
  idempotencyKey: "number-pages-1",
})

Physical pages 2, 4 and 5 receive Page 7 of 9, Page 8 of 9 and Page 9 of 9. N is the final assigned number. Omitted/empty pages means all pages; null, duplicates and out-of-range selections are rejected. Four format templates: number, page_number, number_of_total, page_number_of_total. Positions: top_left, top_center, top_right, bottom_left, bottom_center, bottom_right. Start is 1–999999; font size 8–24 whole points; opacity 0.3–1; margin 12–72 whole points; color is six-digit hex. One static unsigned PDF, at most 2000 pages, existing plan size limits. Source preserved, existing numbers overlaid. Generic batch and workflow steps accept the same flat operation with type: "add_pdf_page_numbers". Retries use the original source and settings. See docs/PDF_PAGE_NUMBERS.md for exact geometry, font and admission policy.

PDF document metadata removal

const submitted = await client.processing.removePdfMetadata(file.id, {
  idempotencyKey: "pdf-metadata-1",
})
const done = await client.processing.wait(submitted.id)
await client.files.download(done.generatedFiles[0].id)

Flat operation { type: "remove_pdf_metadata" }; no settings. Generic batches (require an idempotencyKey) and PDF workflows accept the same operation. Each source is independently verified, rewritten and admitted as a new File, even if already clean. Original Files/metadata stay unchanged. Supported Info/XMP, private editing dictionaries, thumbnails, document IDs and old revisions are removed. Visible text, image/font assets, bookmarks and retained functional content are not anonymized. Comments, hidden layers, external content, forms, encrypted/signed/active/damaged PDFs are unsupported. Existing plan limits, 250 MiB file/output cap and 2000-page cap apply; output may grow. See docs/REMOVE_PDF_METADATA.md for exact strip/retain/reject policy and proof.

Crop / rotate images

client.processing.cropRotateImage(fileId, {rotation: 90, x: 20, y: 30, width: 400, height: 300}) rotates clockwise after EXIF normalization, then crops full-resolution pixels. Omit all four crop fields for rotate-only. Still JPG/PNG only; JPG is re-encoded. Batches use the same pixel rectangle per image and fail out-of-bounds items individually. Sources remain unchanged.

Add a text watermark to an image

const accepted = await client.processing.watermarkImage(sourceFile.id, {
  text: "DRAFT", fontSize: 32, margin: 16, opacity: 0.5,
  color: "#000000", position: "bottom_right", idempotencyKey: "watermark-1",
})
const completed = await client.processing.wait(accepted.id)
const result = await client.files.download(completed.generatedFiles[0].id)

Still JPG/JPEG, PNG and WebP produce a new same-format File; source bytes stay unchanged. Text is 1–120 printable ASCII characters with bundled Bitstream Vera. Font size is 8–512 and margin 0–1024 source pixels after orientation normalization; opacity is 0.05–1. A non-fitting mark fails rather than shrinking. Existing 50 MiB, 8192-pixel-side, 20-million-pixel and plan limits apply. JPG is re-encoded; PNG/WebP use lossless encoding of the composited pixels. Private metadata is removed.

Use { type: "watermark_image", text: "DRAFT" } in processing.batch or a workflow step. Independent items can fail individually; failed-only retry and successful-output ZIP use the existing methods. Same-format workflow inference preserves WebP, so JPG/PNG-only downstream operations require conversion first. Job/event projections omit private text and _image snapshots.

Video to MP3 and Extract Audio

Upload verified MP4, MOV, WebM or MKV video through files.upload. Both operations select the first audio stream in physical stream order and preserve the source. Sources and outputs are capped at 250 MiB, 30 minutes and your existing smaller plan limit; mono/stereo at 8–48 kHz is supported. Missing audio, encrypted media, unsupported codecs/streams and oversized results fail explicitly. WAV is larger and does not restore detail lost in a compressed source.

const created = await client.processing.videoToMp3(file.id, {
  bitrate: 192, // 128 | 192 | 256 | 320; defaults to 192
  idempotencyKey: "clip-mp3-1",
  signal,
});
const result = await client.processing.wait(created.id, { signal });
const audio = await client.files.download(result.generatedFiles[0].id);
const info = await client.files.media(file.id, { signal });

const m4a = await client.processing.extractAudio(file.id, {
  format: "m4a", // mp3 (default) | m4a | wav
  idempotencyKey: "clip-m4a-1",
});

MP3 is re-encoded at the requested bitrate. M4A copies compatible AAC-LC packets; otherwise it transcodes to AAC at 192 kbps. WAV uses PCM 16-bit/48 kHz. bitrate is accepted only for MP3. Request validators reject arbitrary FFmpeg options and private server snapshots before sending a request.

Independent processing.batch, failed-only retry and output ZIP use the existing contracts. For example, pass operation: { type: "extract_audio", format: "mp3", bitrate: 128 } with a unique idempotencyKey. Both operations also work as a one-step terminal workflow; existing operations do not consume audio outputs. Job results expose actual output IDs, MIME types and sizes. Signed job events use the same operation names and never include _media validation snapshots or private storage URLs. See examples/extract-audio.mjs.

Trim video and audio

const media = await client.files.trimMedia(source.id) // authorized, native duration
const created = await client.processing.trimVideo(source.id, {
  startSeconds: 0.737, endSeconds: 2.237, idempotencyKey: "trim-clip-1",
})
const job = await client.processing.wait(created.id)
const actual = await client.files.trimMedia(job.generatedFiles[0].id)
const download = await client.files.download(job.generatedFiles[0].id)
// Audio uses the same timestamp contract:
await client.processing.trimAudio(audio.id, { startSeconds: 0.25, endSeconds: 1.25 })

Seconds are finite numbers with up to three decimal places; select at least 0.1 s. Each range must fit the actual source duration. Batch items and downstream workflow steps validate their own inputs and never silently clamp shared ranges. Video produces a re-encoded H.264/yuv420p MP4 with AAC/48 kHz when sound is present; silent video remains silent. Audio produces PCM16 WAV/48 kHz, preserving mono or stereo. MP3, M4A and WAV audio are supported; video uses bounded progressive SDR, even square pixels up to 1080p (portrait included), 10–60 fps. No stream-copy or frame-exact claim. Source Files, quotas, private downloads, signed events and retry semantics retain their existing contracts. See docs/MEDIA_TRIM_V1.md.

Audio converter

client.processing.convertAudio(fileId, { format: "flac" }) uses generic processing Jobs and private Files. Supports MP3, WAV/PCM16, M4A/AAC, FLAC16, OGG/Vorbis and Ogg/Opus. See docs/AUDIO_CONVERTER_V1.md for limits and supported formats.

Video Format Converter

const accepted = await client.processing.convertVideo(fileId, {
  format: "webm",       // mp4 | mov | mkv | webm
  resolution: 720,      // original (default) | 1080 | 720 | 480
  quality: "balanced", // balanced (default) | high | small
  frameRate: "original", // original (default) | 24 | 25 | 30
  audio: "keep",       // keep (default) | remove
  idempotencyKey: "my-video-conversion",
});
const job = await client.processing.wait(accepted.id);
const actualOutput = await client.files.download(job.generatedFiles[0].id);

MP4/MOV/MKV use H.264/yuv420p and AAC; WebM uses VP9/yuv420p and Opus. Retained audio is 192 kbps/48 kHz and mono/stereo follows the source. Silent videos remain silent. Every profile re-encodes: no remux, stream-copy, HDR or HLS output. Metadata and chapters are removed. Resolution caps the shorter side without upscaling; right-angle display rotation is applied to pixels. Original frame timing supports VFR; explicit FPS can duplicate/drop frames. Output size is not guaranteed.

Sources: MP4/MOV/MKV/WebM with one progressive SDR video stream and optionally one supported mono/stereo audio stream, even square pixels up to 1920×1080 including portrait, 10–60 fps, 30 minutes/250 MiB plus plan caps. Reject extra tracks, encryption and unsupported variants. Resource-expensive inputs can fail safely within existing media limits.

Use the same operation in processing.batch for common settings, failed-only retry and ZIP downloads. Workflow compatibility follows the selected output format; e.g. convert WebM then trim video. Processing events expose public settings, never the private source-inspection snapshot. Source/result playback uses authorized File routes. Browser-incompatible outputs remain downloadable without a hidden derivative conversion.

Video to HLS

const accepted = await client.processing.videoToHls(fileId, {
  mode: "adaptive",
  resolution: 720,
  segmentSeconds: 6,
  idempotencyKey: "video-to-hls-01",
});
const job = await client.processing.wait(accepted.id);
const fileIdToDownload = job.generatedFiles[0].id;
const manifest = await client.processing.hlsManifest(fileIdToDownload);
const zip = await client.files.download(fileIdToDownload);

VideoHlsRequest also works in independent batches and as a terminal workflow step. HlsPackageManifest lists the real package size, codecs, resolutions and segment durations. The output File is a ZIP with MPEG-TS segments and relative VOD playlists.

Extract PDF Tables

Inspect the source before selecting page-local table regions. Corrections use zero-based row and column indices. Omit selections for automatic extraction.

const source = await client.processing.inspectPdfTables(pdfFileId)
if (!source.tables.length) throw new Error("No supported tables were detected")
const { id } = await client.processing.extractPdfTables(pdfFileId, {
  format: "xlsx",
  tableIds: source.tables.slice(0, 1).map((table) => table.id),
  firstRowHeader: true,
  idempotencyKey: "table-export-1",
})
const job = await client.processing.wait(id)
if (job.status === "done") {
  const result = job.generatedFiles[0]
  const preview = await client.processing.previewPdfTableExport(result.id)
  console.log(preview.tables.map(({ name, rowCount }) => ({ name, rowCount })))
  const download = await client.files.download(result.id)
}

For multiple PDFs, submit an independent batch with shared options and omit tableIds and edits. The operation supports selectable-text PDFs up to 20 MiB and 80 pages within plan limits. The signed job event excludes cells and corrections.

Bulk File Renamer

Use processing.renameFiles(fileIds, { rules, collision, overrides, idempotencyKey }) to create verified copies of existing Files. Pass File IDs in the order you want numbered. For a failed-only retry, use the same rules and overrides, the failed File IDs, their matching retryJobIds, and a fresh idempotency key. Generated File names and IDs are available through processing.waitBatch. Use normal File downloads or processing.downloadZip for the completed outputs. See docs/BULK_FILE_RENAMER_V1.md for supported rules and portable name limits.

Merge spreadsheets

Pass ordered File IDs and one configuration per source. Inspect source or output Files with inspectSpreadsheet. Preview the computed merge with previewSpreadsheetMerge before starting its durable job.

import type { MergeSpreadsheetsOperation } from "@dislify/sdk";

const options: Omit<MergeSpreadsheetsOperation, "type"> = {
  mode: "append",
  format: "xlsx",
  sources: [{ headerRow: 1, delimiter: "auto" }, { headerRow: 1, delimiter: "auto", sheet: "Sales" }],
  columns: [{ name: "Customer", sources: [0, 1] }],
  delimiter: "comma",
  provenance: true,
};
const fileIds = [csv.id, workbook.id];
const preview = await client.processing.previewSpreadsheetMerge(fileIds, options);
const created = await client.processing.mergeSpreadsheets(fileIds, { ...options, idempotencyKey: "sales-merge" });
const job = await client.processing.wait(created.id);

Use mode: "sheets" with format: "xlsx" and columns: [] for separate worksheets. A merge creates one Job and one output File, with lineage to each source. See the spreadsheet merge contract.

Spreadsheet cleanup

Use processing.previewSpreadsheetCleanup(fileId, settings, { review, offset }) to inspect full-data counts and paged proposed changes. Submit processing.cleanSpreadsheet(fileId, { ...settings, expected: [preview.digest] }) after checking the digest is present. Use processing.batch for independent files or a compatible workflow with a deterministic rule plan. See the Spreadsheet Cleaner contract.

Spreadsheet splitting

Use processing.previewSpreadsheetSplit(fileId, settings, { group }) for exact group counts and a bounded sample, then processing.splitSpreadsheet(fileId, { ...settings, groups, expected, idempotencyKey }). Use the returned generated File IDs to download individual outputs or one ZIP. Combined workbook mode can participate in workflows without file-specific groups or a preview digest. See the Spreadsheet Splitter contract.

PDF Scan Cleanup

Call processing.previewPdfScan(fileId, page, { settings, pages: [] }) to inspect a bounded original/proposed pair and processing.cleanPdfScan(fileId, { settings, pages: [], idempotencyKey }) to save a verified PDF. Batches and workflows take shared settings with an empty pages array. See the contract.

Remove blank PDF pages

Use processing.detectBlankPdfPages(fileId) for private detection under all three sensitivity presets. After review, call processing.removeBlankPdfPages([{ fileId, sha256, remove }], { idempotencyKey }) with the exact detection digest and approved original page numbers for each source. Each source must retain at least one page. For failed-only retry, provide the failed selections and retryJobIds. See the operation contract.

Compare PDFs

Pass two distinct File IDs in Original, Revised order. An idempotency key binds that order to a single Job. Use the generated File to download the private JSON report.

const comparison = await client.processing.comparePdfs(originalId, revisedId, {
  idempotencyKey: "statement-revision-2",
});
const completed = await client.processing.wait(comparison.id);
const report = JSON.parse(await (await client.files.download(completed.generatedFiles[0].id)).text());

Each PDF can be up to 20 MiB and 40 pages. One request compares one ordered pair.

Extract embedded images from a PDF

const inventory = await dislify.processing.inspectPdfImages(fileId)
const selected = inventory.images.find((image) => image.supported)
if (!selected) throw new Error("No supported images")
const submission = await dislify.processing.extractPdfImages([{
  fileId,
  sha256: inventory.sha256,
  ids: [selected.id],
  format: "original",
  repeat: "unique",
}], { idempotencyKey: crypto.randomUUID() })
const result = await dislify.processing.wait(submission.id)
const zip = await dislify.processing.downloadZip(result.generatedFiles.map(({ id }) => id))

Image IDs belong to the inspected source digest. original keeps eligible JPEG bytes and uses PNG for other supported assets. occurrences permits multiple placements of the same asset. Use independent batch retry with the original failed review and its Job ID.

Convert PDF to editable Word

const inspection = await dislify.processing.inspectPdfForWord(fileId)
const pages = inspection.pages.filter(({ text }) => text).map(({ page }) => page)
if (!pages.length) throw new Error("Use OCR PDF first")
const job = await dislify.processing.pdfToWord([fileId], {
  pages, images: true, tables: true,
}, { idempotencyKey: crypto.randomUUID() })
const result = await dislify.processing.wait(job.id)
const docx = await dislify.files.download(result.generatedFiles[0].id)

Pass an empty page array to convert all pages. Batches share settings and accept up to three PDFs, subject to plan. Use the failed Job IDs to retry with the original settings.

Convert a PDF to Excel

const settings = { layout: "page", values: "text", firstRowHeader: true } as const
const proposed = await dislify.processing.previewPdfExcel(fileId, settings)
const submitted = await dislify.processing.pdfToExcel([fileId], settings, {
  idempotencyKey: crypto.randomUUID(),
})
const result = await dislify.processing.wait(submitted.id)
const saved = await dislify.processing.previewPdfTableExport(result.generatedFiles[0].id)

Password Protect PDF

Use client.processing.protectPdf(fileIds, { opening, owner }, { restrict, idempotencyKey }). Omit owner for opening-password protection without restrictions. Keep credentials separate from durable job settings and send them only with the authenticated HTTPS submission. Each file gets an independent encrypted PDF. Submit fresh credentials with retryJobIds for failed-only retry. Unattended workflows exclude this operation.