AWS compatible API for UnityBase
See _tests/test_aws.js
for usage examples.
Real usage can be found in @unitybase/s3-blob-store/s3BlobStore.js
const s3Client = new aws.S3Client({
URL: 'http://localhost:9000',
credentials: {
accessKeyId: '....',
secretAccessKey: '...'
}
})
s3Client.listBuckets() // [{"Name":"ubbs","CreationDate":"2024-01-03T09:11:57.815Z"},{"Name":"ubbs-ver","CreationDate":"2024-04-25T12:43:39.789Z"}]
// upload buffer to bucket. Content type will be calculated based on `bucketKey` extension
s3Client.upload({
bucket: 'ubbs',
bucketKey: '2024/01/01/test.txt',
buffer: Buffer.from('Hello, світ!')
})
Classes
Methods
# getAmzDate (d: Date) → string inner
Convert date into AMZ Date YYYYMMDDTHHMMSSZ
Arguments:
d
: Date
# parseS3Url (url: string) → Object inner
Parse URL in S3 format `s3://bucket/path/to/object into bucket and bucketKey
Arguments:
url
: string