diff --git a/storage-s3/README.md b/storage-s3/README.md index 29e17e1..6ee7fdb 100644 --- a/storage-s3/README.md +++ b/storage-s3/README.md @@ -13,6 +13,8 @@ import { getObject } from '@frytg/storage-s3'; const object = await getObject('path/to/object.json', { parseJson: true }); ``` +The MinIO client will be initialized with the required environment variables `STORE_S3_ENDPOINT`, `STORE_S3_ACCESS_KEY`, and `STORE_S3_SECRET_KEY`. + ## Methods - [getObject](https://jsr.io/@frytg/storage-s3/doc/~/getObject) @@ -20,6 +22,8 @@ const object = await getObject('path/to/object.json', { parseJson: true }); - [objectExists](https://jsr.io/@frytg/storage-s3/doc/~/objectExists) - [listObjects](https://jsr.io/@frytg/storage-s3/doc/~/listObjects) +Also see all options in the [MinIO API documentation](https://min.io/docs/minio/linux/developers/javascript/API.html). They can be used by importing the `client` object. + ## Author Created by [@frytg](https://github.com/frytg) / [frytg.digital](https://www.frytg.digital) diff --git a/storage-s3/storage.ts b/storage-s3/storage.ts index 94f61a5..269399d 100644 --- a/storage-s3/storage.ts +++ b/storage-s3/storage.ts @@ -1,11 +1,14 @@ /** * Storage module for S3 with common operations using MinIO. + * * @module + * + * @see https://min.io/docs/minio/linux/developers/javascript/API.html */ // import packages import { Buffer } from 'node:buffer' -import type { BucketItem, BucketItemStat, BucketStream, Client } from 'minio/dist/esm/minio.d.mts' +import type { BucketItem, BucketItemStat, BucketStream, Client as ClientType } from 'minio/dist/esm/minio.d.mts' // load utils import { minioClient } from './s3.ts' @@ -13,8 +16,17 @@ import { minioClient } from './s3.ts' /** * The MinIO client. * @type {Client} + * + * @see https://min.io/docs/minio/linux/developers/javascript/API.html + * + * @example Remove an object + * ```ts + * import { Client as minioClient } from '@frytg/storage-s3' + * + * await minioClient.removeObject('mybucket', 'photo.jpg') + * ``` */ -export const client: Client = minioClient +export const Client: ClientType = minioClient /** * Retrieves an object from S3.