Compare commits

..

2 Commits

Author SHA1 Message Date
67244ba5cf 3.0.17 2024-06-17 19:57:56 +02:00
a9bb31c2a2 fix(core): update 2024-06-17 19:57:56 +02:00
4 changed files with 11 additions and 11 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@push.rocks/smartbucket", "name": "@push.rocks/smartbucket",
"version": "3.0.16", "version": "3.0.17",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@push.rocks/smartbucket", "name": "@push.rocks/smartbucket",
"version": "3.0.16", "version": "3.0.17",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"@push.rocks/smartpath": "^5.0.18", "@push.rocks/smartpath": "^5.0.18",

View File

@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartbucket", "name": "@push.rocks/smartbucket",
"version": "3.0.16", "version": "3.0.17",
"description": "A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.", "description": "A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartbucket', name: '@push.rocks/smartbucket',
version: '3.0.16', version: '3.0.17',
description: 'A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.' description: 'A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.'
} }

View File

@ -14,18 +14,18 @@ export class SmartBucket {
/** /**
* the constructor of SmartBucket * the constructor of SmartBucket
*/ */
constructor(configArg: plugins.tsclass.storage.IS3Descriptor) { constructor(configArg: IS3Descriptor) {
this.config = configArg; this.config = configArg;
const endpoint = this.config.endpoint.startsWith('http://') || this.config.endpoint.startsWith('https://')
? this.config.endpoint const protocol = configArg.useSsl === false ? 'http' : 'https';
: `https://${this.config.endpoint}`; const endpoint = `${protocol}://${configArg.endpoint}`;
this.s3Client = new plugins.s3.S3Client({ this.s3Client = new plugins.s3.S3Client({
endpoint, endpoint,
region: this.config.region || 'us-east-1', region: configArg.region || 'us-east-1',
credentials: { credentials: {
accessKeyId: this.config.accessKey, accessKeyId: configArg.accessKey,
secretAccessKey: this.config.accessSecret, secretAccessKey: configArg.accessSecret,
}, },
forcePathStyle: true, // Necessary for S3-compatible storage like MinIO or Wasabi forcePathStyle: true, // Necessary for S3-compatible storage like MinIO or Wasabi
}); });