64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import { ALiYunInstance, ALiYunSDK, CTYunSDK } from '../src/index';
|
|
|
|
const accessKey = '';
|
|
const accessSecret = '';
|
|
|
|
|
|
//测试阿里云文件是否存在
|
|
async function isExistFile() {
|
|
const instance = ALiYunSDK.getInstance(accessKey, accessSecret);
|
|
|
|
const result = await instance.isExistObject(
|
|
'bmzs-release',
|
|
'cn-hangzhou',
|
|
'extraFile/11ef425f-8c96-e3eb-8828-db68e1a0c102.png'
|
|
);
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
async function removeFile() {
|
|
const instance = ALiYunSDK.getInstance(accessKey, accessSecret);
|
|
|
|
const result = await instance.removeFile(
|
|
'bmzs-release',
|
|
'cn-hangzhou',
|
|
'extraFile/11ef425f-8c96-e3eb-8828-db68e1a0c102.png'
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
// isExistFile();
|
|
// removeFile();
|
|
|
|
const accessKey2 = '';
|
|
const accessSecret2 = '';
|
|
|
|
async function isExistCTYunFile() {
|
|
const instance = CTYunSDK.getInstance(accessKey2, accessSecret2);
|
|
|
|
const result = await instance.isExistObject(
|
|
'jiupai-oss-dev',
|
|
'hbwh',
|
|
'extraFile/6e0d90fd-2df2-4c7d-b78b-1c1af1038db5.jpg'
|
|
);
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
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();
|
|
|
|
|