Compare commits

...

3 Commits

Author SHA1 Message Date
7e3b748d30 fix bugs 2025-06-19 00:19:01 +08:00
cd43d66265 update getOBjectname 2025-06-07 12:09:09 +08:00
0dae4872b0 remove: check zero size 2025-05-30 19:47:45 +08:00
3 changed files with 9 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@kevisual/oss",
"version": "0.0.11",
"version": "0.0.12",
"main": "dist/index.js",
"scripts": {
"build": "tsup",

View File

@@ -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') {

View File

@@ -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);