Setu-TS
    Preparing search index...

    Class GcsProvider

    Google Cloud Storage provider.

    Supports native streaming via createReadStream() drained into a web ReadableStream — by async iteration when the stream supports it (every real SDK body does), by 'data'/'end'/'error' events otherwise.

    0.1.0

    Implements

    • StorageProvider
    Index
    • Parameters

      • Optionaloptions: GcsProviderOptions

        GCS connection/injection options

      • now: () => number = ...

        Wall-clock source (epoch ms) for signed-URL expiry. Injected by createProvider as runtime.now() (the only sanctioned clock outside packages/runtime). Defaults to () => 0 for direct construction.

      Returns GcsProvider

    isHealthy?: () => Promise<boolean>

    M70c: delegates to the injected client's optional isHealthy?() (the real adapter calls bucket.exists()). Assigned in connect() only when the client provides the member; a client that omits it is unknown, and the indicator reads absence (not false) as that.

    0.1.0

    • Retrieves an object from GCS; null when absent.

      Parameters

      • path: string

        Object key

      Returns Promise<Uint8Array<ArrayBufferLike> | null>

      The object bytes, or null

    • Creates a signed GET URL for a GCS object.

      Parameters

      • path: string

        Object key

      • options: { expiresIn: number }

        Expiry in seconds

      Returns Promise<string>

      The signed URL

    • Native stream download — adapts GCS createReadStream() into a web ReadableStream (no node: import needed).

      The adapter is chosen by probing the stream, because IGcsClient types it as unknown: a real SDK body is a node Readable and is async-iterated, an injected client emitting only 'data'/'end'/'error' takes the event path, and a value carrying neither is refused by name. The refusal is a REJECTION, never a synchronous throw — this method is typed Promise<…>, so a caller using .catch() must be able to see it.

      Cancellation-safe on both paths: the cancel hook releases the source and destroys the underlying request, so a consumer cancelling mid-download neither leaks the connection nor crashes the process (previously the eager drain kept flowing after a cancel and the next chunk enqueued into the closed controller as an uncaught TypeError). Still an EAGER drain by documented contract — see provider-stream.ts and the README's per-provider table.

      Parameters

      • path: string

        Object key

      Returns Promise<ReadableStream<Uint8Array<ArrayBufferLike>> | null>

      A ReadableStream, null if absent, or a rejection naming the unusable stream shape

    • Stores an object in GCS, recording any content type and user metadata on the object itself so a signed URL serves it under the right type.

      Parameters

      • path: string

        Object key

      • data: Uint8Array

        Object bytes

      • Optionaloptions: PutObjectOptions

        Object attributes to record with the bytes

      Returns Promise<void>