Skip to main content

SyncsnapServer API

Import: import { SyncsnapServer } from "syncsnap";

Constructor

const client = new SyncsnapServer();
Uses process.env.SYNCSNAP_TOKEN and the default SyncSnap API base URL.

Methods

createJob()

createJob(): Promise<CreateJobResponse>
Creates a new job. Returns { id, projectId, status, createdAt, updatedAt }.

getJob(jobId)

getJob(jobId: string): Promise<Job>
Returns the current job for the given ID.

getUploadUrl(jobId, options)

getUploadUrl(
  jobId: string,
  options: { fileName: string; expirationMinutes?: number }
): Promise<PresignedUrlResponse>
Returns a presigned upload URL for the job.

getDownloadUrl(jobId, options?)

getDownloadUrl(
  jobId: string,
  options?: { expirationMinutes?: number }
): Promise<PresignedUrlResponse>
Returns a presigned download URL for a completed job.

waitForJobCompletion(jobId, options?)

waitForJobCompletion(
  jobId: string,
  options?: WaitForJobOptions
): Promise<Job>
Polls until status is completed or failed, or until timeout/abort. WaitForJobOptions:
OptionTypeDefaultDescription
intervalMsnumber2000Poll interval in ms.
timeoutMsnumber120000Timeout in ms.
onPoll(job: Job) => voidCalled on each poll.
signalAbortSignalAbort to stop polling.
See SyncsnapServer for usage.