Comparing version 0.2.2 to 0.2.3
@@ -20,27 +20,2 @@ 'use strict'; | ||
/** | ||
* Upload file to the storage | ||
* | ||
* @param {Stream} src | ||
* @param {object} options | ||
* @returns {Promise} | ||
*/ | ||
upload(src, options = {}) { | ||
const directory = options.directory || ''; | ||
const filename = options.filename || uuidV4(); | ||
const filePath = path.posix.join(directory, filename); | ||
const result = { | ||
filePath, | ||
url: url.resolve(this.storage.baseUrl, filePath) | ||
}; | ||
if (!src) | ||
throw new TypeError('Source must be stream'); | ||
debug(`[upload] path=${result.filePath} url=${result.url}`); | ||
return this.storage.upload(src, filePath) | ||
.then(() => result); | ||
} | ||
/** | ||
* Download file from the storage | ||
@@ -78,2 +53,27 @@ * | ||
/** | ||
* Upload file to the storage | ||
* | ||
* @param {Stream} src | ||
* @param {object} options | ||
* @returns {Promise} | ||
*/ | ||
upload(src, options = {}) { | ||
const directory = options.directory || ''; | ||
const filename = options.filename || uuidV4(); | ||
const filePath = path.posix.join(directory, filename); | ||
const result = { | ||
filePath, | ||
url: url.resolve(this.storage.baseUrl, filePath) | ||
}; | ||
if (!src) | ||
throw new TypeError('Source must be stream'); | ||
debug(`[upload] path=${result.filePath} url=${result.url}`); | ||
return this.storage.upload(src, filePath) | ||
.then(() => result); | ||
} | ||
/** | ||
* Remove the data from storage | ||
@@ -80,0 +80,0 @@ * |
{ | ||
"name": "giga", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Easy streaming upload and download for storages(File System, AWS S3)", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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