Comparing version 0.2.0 to 0.2.1
'use strict'; | ||
const path = require('path'); | ||
const url = require('url'); | ||
const uuidV4 = require('uuid/v4'); | ||
@@ -27,3 +28,4 @@ | ||
const result = { | ||
filePath | ||
filePath, | ||
url: url.resolve(this.storage.baseUrl, filePath) | ||
}; | ||
@@ -53,3 +55,6 @@ | ||
const result = { filePath }; | ||
const result = { | ||
filePath, | ||
url: url.resolve(this.storage.baseUrl, filePath) | ||
}; | ||
return this.storage.download(filePath, options) | ||
@@ -56,0 +61,0 @@ .then(src => { |
{ | ||
"name": "giga", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Easy streaming upload and download for storages(File System, AWS S3)", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const path = require('path'); | ||
const url = require('url'); | ||
@@ -44,3 +45,9 @@ | ||
this.protocol = 'file'; | ||
this.root = path.normalize(this.options.root); | ||
const baseUrl = url.format({ | ||
protocol: this.protocol, | ||
host: this.root | ||
}); | ||
this.baseUrl = baseUrl.replace(/([^/])$/, '$1/'); | ||
} | ||
@@ -47,0 +54,0 @@ |
'use strict'; | ||
const url = require('url'); | ||
const S3 = require('aws-sdk/clients/s3'); | ||
@@ -21,3 +22,10 @@ | ||
}, options); | ||
this.protocol = 's3'; | ||
this.bucket = this.options.bucket; | ||
const baseUrl = url.format({ | ||
protocol: this.protocol, | ||
host: this.bucket, | ||
slashes: true | ||
}); | ||
this.baseUrl = baseUrl.replace(/([^/])$/, '$1/'); | ||
this.options.params['Bucket'] = this.bucket; | ||
@@ -24,0 +32,0 @@ this.client = new S3(this.options); |
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
11578
253