add oss for download
This commit is contained in:
@@ -1,13 +1,32 @@
|
||||
import { ItemBucketMetadata, Client } from 'minio';
|
||||
type UploadedObjectInfo = {
|
||||
export type UploadedObjectInfo = {
|
||||
etag: string;
|
||||
lastModified?: Date;
|
||||
size?: number;
|
||||
versionId: string;
|
||||
metadata?: ItemBucketMetadata;
|
||||
};
|
||||
export type StatObjectResult = {
|
||||
size: number;
|
||||
etag: string;
|
||||
lastModified: Date;
|
||||
size: number;
|
||||
versionId: string;
|
||||
metadata: ItemBucketMetadata;
|
||||
metaData: ItemBucketMetadata;
|
||||
versionId?: string | null;
|
||||
};
|
||||
|
||||
export type ListFileObject = {
|
||||
name: string;
|
||||
size: number;
|
||||
lastModified: Date;
|
||||
etag: string;
|
||||
};
|
||||
export type ListDirectoryObject = {
|
||||
prefix: string;
|
||||
size: number;
|
||||
};
|
||||
export type ListObjectResult = ListFileObject | ListDirectoryObject;
|
||||
export interface OssBaseOperation {
|
||||
prefix: string;
|
||||
setPrefix(prefix: string): void;
|
||||
/**
|
||||
* 获取对象
|
||||
* @param objectName 对象名
|
||||
@@ -29,7 +48,7 @@ export interface OssBaseOperation {
|
||||
* 获取对象信息
|
||||
* @param objectName 对象名
|
||||
*/
|
||||
statObject(objectName: string): Promise<any>;
|
||||
statObject(objectName: string): Promise<StatObjectResult>;
|
||||
/**
|
||||
* 删除对象
|
||||
* @param objectName 对象名
|
||||
@@ -37,9 +56,24 @@ export interface OssBaseOperation {
|
||||
deleteObject(objectName: string): Promise<any>;
|
||||
/**
|
||||
* 列出对象
|
||||
* @param prefix 前缀
|
||||
* @param objectName 对象名
|
||||
* @param opts 选项
|
||||
* @param opts.recursive 是否递归
|
||||
* @param opts.startAfter 开始位置
|
||||
*/
|
||||
listObjects(prefix: string, opts?: { recursive?: boolean }): Promise<any>;
|
||||
listObjects(
|
||||
objectName: string,
|
||||
opts?: {
|
||||
/**
|
||||
* 是否递归
|
||||
*/
|
||||
recursive?: boolean;
|
||||
/**
|
||||
* 开始位置
|
||||
*/
|
||||
startAfter?: string;
|
||||
},
|
||||
): Promise<ListObjectResult[]>;
|
||||
/**
|
||||
* 复制对象
|
||||
* @param sourceObject 源对象
|
||||
@@ -47,3 +81,7 @@ export interface OssBaseOperation {
|
||||
*/
|
||||
copyObject: Client['copyObject'];
|
||||
}
|
||||
|
||||
export interface OssService extends OssBaseOperation {
|
||||
owner: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user