Compare commits
3 Commits
ab29a1eb0b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e3b748d30 | |||
| cd43d66265 | |||
| 0dae4872b0 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/oss",
|
||||
"version": "0.0.11",
|
||||
"version": "0.0.12",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
|
||||
12
src/index.ts
12
src/index.ts
@@ -152,14 +152,18 @@ export class OssBase implements OssBaseOperation {
|
||||
const obj = await this.client.fPutObject(bucketName, `${this.prefix}${objectName}`, filePath, metaData);
|
||||
return obj as any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取完整的对象名称
|
||||
* @param objectName
|
||||
* @returns
|
||||
*/
|
||||
async getObjectName(objectName: string) {
|
||||
return `${this.prefix}${objectName}`;
|
||||
}
|
||||
async statObject(objectName: string, checkFile = true) {
|
||||
const bucketName = this.bucketName;
|
||||
try {
|
||||
const obj = await this.client.statObject(bucketName, `${this.prefix}${objectName}`);
|
||||
if (obj && checkFile && obj.size === 0) {
|
||||
return null;
|
||||
}
|
||||
return obj;
|
||||
} catch (e) {
|
||||
if (e.code === 'NotFound') {
|
||||
|
||||
@@ -54,7 +54,6 @@ export const sendObject = async ({ res, objectName, client, isDownload = false }
|
||||
etag,
|
||||
'last-modified': lastModified,
|
||||
'Content-Disposition': contentDisposition,
|
||||
'file-name': filename,
|
||||
...filteredMetaData,
|
||||
});
|
||||
const objectStream = await client.getObject(objectName);
|
||||
|
||||
Reference in New Issue
Block a user