Skip to content

Node.js client for object stores like AWS S3, GCP GCS or Minio

License

Notifications You must be signed in to change notification settings

relaycorp/object-storage-js

Folders and files

NameName
Last commit message
Last commit date
Jul 31, 2023
Dec 22, 2022
Jan 21, 2021
Jan 24, 2021
Jan 25, 2021
Jan 22, 2021
Jan 21, 2021
Jan 21, 2021
Dec 22, 2022
Jan 25, 2021
Jan 24, 2021
Dec 22, 2021
Nov 9, 2021
Jul 29, 2024
Jun 17, 2024
Jan 22, 2021
Jan 21, 2021
Jan 21, 2021
Dec 22, 2021

Repository files navigation

@relaycorp/object-storage

This library allows you to interact with major object storage backends (e.g., Amazon S3) using a unified interface.

Install

Releases are automatically pushed to NPM. For example, to get the latest release, run:

npm install @relaycorp/object-storage

Supported backends

Backend Name SDK used internally Access/secret key support
Amazon S3 s3 AWS Optional
Google Cloud Storage (GCS) gcs GCP Unsupported. Use alternative authentication methods instead, like workload identity.
Minio minio AWS Required

Supported operations

  • Get object (along with its metadata).
  • Create/update object (along with its metadata).
  • Delete object.
  • List objects under a given prefix. Pagination is handled automatically: We return an iterable and retrieve the next page lazily.

We welcome PRs to support additional operations, as long as each new operation is supported across all backends in a normalised way, and has unit and functional tests.

Example

import { initObjectStoreClient } from '@relaycorp/object-storage';

async function main(): Promise<void> {
  const client = initObjectStoreClient(
    process.env.STORE_BACKEND,
    process.env.STORE_ENDPOINT,
    process.env.STORE_ACCESS_KEY,
    process.env.STORE_SECRET_KEY,
  );

  for await (const objectKey of client.listObjectKeys("prefix/", process.env.STORE_BUCKET)) {
    console.log("- ", objectKey)
  }
}

API documentation

The API documentation can be found on docs.relaycorp.tech.

Contributing

We love contributions! If you haven't contributed to a Relaycorp project before, please take a minute to read our guidelines first.