Comparing version 0.1.2 to 0.1.10
@@ -48,7 +48,7 @@ declare const chalk: any; | ||
constructor(options: OptionsInt); | ||
initEvent(): Promise<void>; | ||
getRemoteKey(): Promise<unknown>; | ||
initEvent(): Promise<false | undefined>; | ||
getRemoteKey(): Promise<{}>; | ||
uploadFile(destinationPath: string): Promise<void>; | ||
putLocalFile: (filename: string, path: any) => Promise<unknown>; | ||
putBuffer: (filename: string, data: string) => Promise<unknown>; | ||
putLocalFile: (filename: string, path: any) => Promise<{}>; | ||
putBuffer: (filename: string, data: string) => Promise<{}>; | ||
} |
@@ -148,3 +148,8 @@ "use strict"; | ||
this.DESTINATION_PATH = path.join(TMP_DIR, Date.now() + '.zip'); | ||
this.initEvent().catch(function (err) { return printLog(chalk.red(err.msg)); }); | ||
this.initEvent() | ||
.catch(function (err) { | ||
var msg = err.msg; | ||
printLog(chalk.red(msg)); | ||
throw new Error(msg); | ||
}); | ||
} | ||
@@ -163,5 +168,7 @@ OssCDN.prototype.initEvent = function () { | ||
remoteKeyRes = _b.sent(); | ||
if (remoteKeyRes['code'] == 200) { | ||
this.option.remoteKey = remoteKeyRes['data'].remoteKeys; | ||
if (remoteKeyRes['code'] != 200) { | ||
process.exit(); | ||
return [2 /*return*/, false]; | ||
} | ||
this.option.remoteKey = remoteKeyRes['data'].remoteKeys; | ||
destinationStream = fs.createWriteStream(DESTINATION_PATH); | ||
@@ -208,2 +215,3 @@ if (uploadUrl) { | ||
}, function (err, response, body) { | ||
console.log(err, body); | ||
try { | ||
@@ -210,0 +218,0 @@ body = JSON.parse(body); |
{ | ||
"name": "post-oss", | ||
"version": "0.1.2", | ||
"version": "0.1.10", | ||
"description": "oss upload", | ||
@@ -24,2 +24,3 @@ "main": "index.js", | ||
"@types/node": "12.7.5", | ||
"@zuzuche/zzc-oss-agent": "1.0.2", | ||
"archiver": "3.1.1", | ||
@@ -26,0 +27,0 @@ "chalk": "2.4.2", |
86891
8
355
6
+ Added@zuzuche/zzc-oss-agent@1.0.2