fgb-vt - v1.0.4
    Preparing search index...

    Class S3Connector

    S3 connector using AWS SDK v3 (@aws-sdk/client-s3).

    The SDK is a peer dependency -- it is only required at runtime if this connector is instantiated. Byte-range reads use GetObject with an HTTP Range header, identical to how the AWS CLI performs partial downloads.

    The S3 client is created lazily on the first read and reused for all subsequent requests. Call S3Connector.close to destroy the client and release its underlying HTTP connection pool.

    import { S3Connector } from 'fgb-vt';

    const connector = new S3Connector({
    region: 'us-east-1',
    maxConcurrency: 8,
    });

    const bytes = await connector.read(
    's3://my-bucket/tiles/buildings.fgb',
    0,
    1024,
    );

    await connector.close();
    const minio = new S3Connector({
    region: 'us-east-1',
    endpoint: 'http://localhost:9000',
    forcePathStyle: true,
    credentials: {
    accessKeyId: 'minioadmin',
    secretAccessKey: 'minioadmin',
    },
    });

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Destroy the underlying S3Client and release its HTTP connection pool.

      After calling this method, the connector must not be used for further reads. Calling close() on an already-closed connector is a safe no-op.

      Returns Promise<void>

      Resolves when the client has been destroyed.

    • Read a contiguous byte range from an S3 object using a GetObject request with a Range: bytes=offset-(offset+length-1) header.

      The S3 client is lazily initialized on the first call.

      Parameters

      • path: string

        S3 path in s3://bucket/key or bucket/key format.

      • offset: number

        Zero-based byte offset to begin reading from.

      • length: number

        Number of bytes to read.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      The requested byte range.

      If the S3 response body is empty.

      If the @aws-sdk/client-s3 peer dependency is not installed (on first call only).

      If the SDK GetObject call fails (permissions, invalid bucket/key, network errors, etc.).

    • Read multiple byte ranges from the same S3 object.

      Each range is fetched as a separate GetObject call with a Range header. Calls are dispatched through a worker pool limited to S3ConnectorOptions.maxConcurrency concurrent requests. Results are returned in the same order as the input ranges.

      Parameters

      • path: string

        S3 path in s3://bucket/key or bucket/key format.

      • ranges: readonly { length: number; offset: number }[]

        Array of { offset, length } byte-range descriptors.

      Returns Promise<Uint8Array<ArrayBufferLike>[]>

      Array of Uint8Array chunks in the same order as the input ranges. Returns an empty array when ranges is empty.

      If any individual GetObject call fails after the request is issued.