Represents the ephemeral, modifiable state used by the pipeline.

  • Mutable: Evolves as you walk the plugin chain.
  • Shared Data: Allows plugins to communicate partial results, discovered data, or interim errors.
  • Ephemeral: Typically discarded once fetch(...) completes.
interface PluginContext {
    accept?: string;
    cid: CID<unknown, number, number, Version>;
    directoryEntries?: UnixFSEntry[];
    errors?: PluginError[];
    isDirectory?: boolean;
    modified: number;
    options?: Omit<VerifiedFetchInit, "signal"> & AbortOptions;
    path: string;
    pathDetails?: PathWalkerResponse;
    query: ParsedUrlQuery;
    reqFormat?: RequestFormatShorthand;
    resource: string;
    withServerTiming?: boolean;
    onProgress?(evt): void;
    [key: string]: unknown;
}

Indexable

[key: string]: unknown

Properties

accept?: string
cid: CID<unknown, number, number, Version>
directoryEntries?: UnixFSEntry[]
errors?: PluginError[]
isDirectory?: boolean
modified: number

The last time the context is modified, so we know whether a plugin has modified it. A plugin should increment this value if it modifies the context.

options?: Omit<VerifiedFetchInit, "signal"> & AbortOptions
path: string
pathDetails?: PathWalkerResponse
resource: string
withServerTiming?: boolean

Methods