Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for key prefix configuration #42

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', "prettier"],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
"rules": {
"no-empty": 0,
"ordered-imports": 0,
"object-literal-sort-keys": 0,
"no-console": 0,
"no-var-requires": 0,
"prefer-object-spread": 0,
"no-shadowed-variable": 0,
"no-implicit-dependencies": 0,
"no-submodule-imports": 0,
"max-classes-per-file": 1,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-explicit-any": 0,
}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ test.*
node_modules
lib
.idea
package-lock.json
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ const AWOS = require('awos-js')
### for Aliyun OSS

```javascript
import { build } from 'awos-js'

// for v3.*.*
const client = build({
storageType: 'oss',
accessKeyID: "xxx",
accessKeySecret: "xxx",
bucket: "my_bucket",
endpoint: 'endpoint',
})

// for v2.*.*
const client = new AWOS.Client({
type: 'oss',
ossOptions: {
Expand All @@ -43,11 +55,26 @@ const client = new AWOS.Client({
})
```

### for Amazon S3(minio)
### for AWS-S3 / MINIO

```javascript
import { build } from 'awos-js'

// for v3.*.*
const client = build({
storageType: 'aws',
accessKeyID: "xxx",
accessKeySecret: "xxx",
// when use aws s3, endpoint is unnecessary and region must be set
endpoint: "https://xxxx.myminio.com",
bucket: "my_bucket",
// when use minio, S3ForcePathStyle must be set true
s3ForcePathStyle: true,
})

// For v2.*.*
const client = new AWOS.Client({
type: 'aws',
storageType: 'aws',
awsOptions: {
accessKeyId: 'accessKeyId',
secretAccessKey: 'secretAccessKey',
Expand Down Expand Up @@ -77,6 +104,9 @@ copy(key: string, source: string, options?: ICopyObjectOptions): Promise<void>;
```

### Change Log
- v3.0.0 / 2024-01-18
- **[Breaking]** refactor configuration options ⚠️
- support common prefix configuration

- v2.0.0 / 2020-06-18
- Breaking
Expand All @@ -94,6 +124,3 @@ copy(key: string, source: string, options?: ICopyObjectOptions): Promise<void>;

- v1.0.1 / 2019-03-19
- bug fix: oss listObject() should return [] when options.prefix not exist in the bucket; oss listObject() maxKeys not working



Loading