Comparing version 1.0.1 to 2.0.0
11
index.js
@@ -40,7 +40,8 @@ var sha256 = require('crypto-js/sha256'); | ||
const service = 's3'; | ||
const host = (this.domain !== 'digitaloceanspaces.com') | ||
? `${bucket}.${service}.${this.region}.${this.domain}` | ||
: `${bucket}.${this.region}.${this.domain}` | ||
const host = this.host ? this.host : | ||
(this.domain !== 'digitaloceanspaces.com') | ||
? `${bucket}.${service}.${this.region}.${this.domain}` | ||
: `${bucket}.${this.region}.${this.domain}` | ||
const encodedPath = encodePath(path); | ||
const encodedPath = this.pathBucket ? encodePath(`/${bucket}/${path}`) : encodePath(`/${path}`); | ||
const endpoint = `https://${host}${encodedPath}`; | ||
@@ -97,2 +98,4 @@ | ||
this.domain = (config.domain !== undefined) ? config.domain : defaultDomain; | ||
this.host = config.host; | ||
this.pathBucket = config.pathBucket; | ||
} | ||
@@ -99,0 +102,0 @@ |
{ | ||
"name": "amazon-s3", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Read and write to AWS S3 using fetch()", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,3 +24,3 @@ # amazon-s3 | ||
let bucket = 'testbucket'; | ||
let key = '/a/test/file.txt'; | ||
let key = 'a/test/file.txt'; | ||
let body = 'test file contents'; | ||
@@ -27,0 +27,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6689
88