Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
frytg committed Dec 18, 2024
1 parent ba71bc5 commit 9682197
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions storage-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ 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)
- [uploadObject](https://jsr.io/@frytg/storage-s3/doc/~/uploadObject)
- [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)
Expand Down
16 changes: 14 additions & 2 deletions storage-s3/storage.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
/**
* 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'

/**
* 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.
Expand Down

0 comments on commit 9682197

Please sign in to comment.