DeployKit

File and manifest helpers

Exact inputs, return values and reading behavior for the common file APIs.

Promise helpers

Import these from @deploykit/node. Every return value below is wrapped in a Promise. Optional RunOptions is { signal?: AbortSignal }.

FunctionParametersReturnsReading behavior
artifactFromDirectorydirectory: string, options?: RunOptionsArtifactWalks and stats files; contents remain lazy
artifactFromFilesReadonlyArray<FileInput>, options?: RunOptionsArtifactValidates paths and stats local file entries
artifactFromManifestmanifest: unknown, read: StreamReader, options?: RunOptionsArtifactDecodes object or JSON; attaches lazy sources
manifestFromDirectorydirectory: string, options: BuildOptions & RunOptionsManifestStreams every file to compute SHA-256
manifestFromArtifactartifact: Artifact, options: BuildOptions & RunOptionsManifestStreams entries and verifies sizes/existing SHA-256
waitUntilServingurl: string, options?: ServingOptionsnumberPolls HTTP; returns the accepted status

FileInput

Choose exactly one content form:

export type FileInput =
  | { readonly path: string; readonly text: string }
  | { readonly path: string; readonly bytes: Uint8Array }
  | { readonly path: string; readonly file: string }

path is the destination path. file is a local filesystem path. Text uses UTF-8. Generated text and byte arrays are resident memory. For large remote content, use a manifest reader rather than allocating a full byte array. Directory readers include dotfiles and do not freeze mutable files. Duplicate or unsafe destination paths fail before upload.

BuildOptions

OptionTypeDefault / behavior
source(path: string) => stringRequired; assigns an opaque replayable storage reference
concurrencynumber4; integer from 1 through 32
timeoutMsnumber30000 per file; positive safe integer
signalAbortSignalPromise helpers only

The builder does not upload, snapshot or choose storage. It computes SHA-256, not new provider fingerprints. Existing Source fingerprints are preserved after byte verification. See stored artifacts.

StreamReader

export type StreamReader = (
  reference: string,
  signal: AbortSignal
) => Promise<ReadableStream<Uint8Array>>

Return a fresh stream for each invocation and forward the signal. Open/read failures become SourceError; bytes that do not match the declared size or hash become IntegrityError. A supplied reader can allocate outside deploykit's memory reservation budget.

ServingOptions

OptionDefaultMeaning
timeoutMs60000Overall deadline, including polling and response cleanup
acceptHTTP 2xx(status: number) => boolean
fetchGlobal fetchInjected transport; must honor its signal
signalUnsetPromise helper cancellation

Requests do not follow redirects. A timeout or unmet status produces NotServingError. The Effect helper also accepts a custom schedule, bounded by the overall deadline. Serving availability is not an application correctness check.

Effect equivalents

TaskPublic API
Construct entriesEntry.text, Entry.bytes, Entry.file, Entry.deferred
Build or inspect an artifactArtifact.make, add, get, has, list, fileCount, sizeOf, totalSize
Layer files intentionallyArtifact.layered
Decode/encode wire manifestsManifest.decode, encode, fromJson, toArtifact
Build manifestsfromDirectory, fromArtifact from @deploykit/core/manifest-builder
Adapt Promise sourcesSource.fromPromise, Source.fromReadableStream
Check HTTP servingPlatform.waitUntilServing

Use the exact core declarations for overloads, layering options, filesystem requirements, errors and schema exports. Source.fromPromise is a bounded-buffer convenience; prefer fromReadableStream for large objects.

Last updated on

On this page