天翼云 判断文件存在跟删除 测试通过
This commit is contained in:
parent
db5b28f751
commit
c0ccf1892c
|
|
@ -207,7 +207,7 @@ export class CTYunInstance {
|
|||
catch (err) {
|
||||
throw new OakNetworkException();
|
||||
}
|
||||
if (response.status === 204) {
|
||||
if (response.status === 204 || response.status === 200) {
|
||||
return true;
|
||||
}
|
||||
const text = await response.text();
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ class CTYunInstance {
|
|||
catch (err) {
|
||||
throw new Exception_1.OakNetworkException();
|
||||
}
|
||||
if (response.status === 204) {
|
||||
if (response.status === 204 || response.status === 200) {
|
||||
return true;
|
||||
}
|
||||
const text = await response.text();
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ export class CTYunInstance {
|
|||
} catch (err) {
|
||||
throw new OakNetworkException();
|
||||
}
|
||||
if (response.status === 204) {
|
||||
if (response.status === 204 || response.status === 200) {
|
||||
return true;
|
||||
}
|
||||
const text = await response.text();
|
||||
|
|
|
|||
|
|
@ -29,35 +29,35 @@ async function removeFile() {
|
|||
}
|
||||
|
||||
// isExistFile();
|
||||
removeFile();
|
||||
// removeFile();
|
||||
|
||||
const accessKey2 = '';
|
||||
const accessSecret2 = '';
|
||||
|
||||
async function removeCTYunFile() {
|
||||
const instance = CTYunSDK.getInstance(accessKey2, accessSecret2);
|
||||
|
||||
const result = await instance.removeFile(
|
||||
'jiupai-oss-dev',
|
||||
'hbwh',
|
||||
'fff.jpg'
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
async function isExistCTYunFile() {
|
||||
const instance = CTYunSDK.getInstance(accessKey2, accessSecret2);
|
||||
|
||||
const result = await instance.isExistObject(
|
||||
'jiupai-oss-dev',
|
||||
'hbwh',
|
||||
'fff.jpg'
|
||||
'extraFile/6e0d90fd-2df2-4c7d-b78b-1c1af1038db5.jpg'
|
||||
);
|
||||
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
// removeCTYunFile();
|
||||
async function removeCTYunFile() {
|
||||
const instance = CTYunSDK.getInstance(accessKey2, accessSecret2);
|
||||
|
||||
const result = await instance.removeFile(
|
||||
'jiupai-oss-dev',
|
||||
'hbwh',
|
||||
'extraFile/6e0d90fd-2df2-4c7d-b78b-1c1af1038db5.jpg'
|
||||
);
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
// isExistCTYunFile();
|
||||
// removeCTYunFile();
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue