UNPKG

@eleven-am/nestjs-storage

Version:

A NestJS module for uploading files to cloud storage providers

24 lines (23 loc) 1.17 kB
import { Provider } from '../types/options'; import { Header206, IFile, PartialStream } from '../types/storage'; export declare abstract class BaseStorage { protected readonly provider: Provider; protected constructor(provider: Provider); get storageProvider(): Provider; abstract putFile(path: string, data: Buffer): Promise<IFile>; abstract getFileOrFolder(fileId: string): Promise<IFile>; abstract readFile(fileId: string): Promise<NodeJS.ReadableStream>; abstract deleteFileOrFolder(fileId: string): Promise<boolean>; abstract moveFileOrFolder(fileId: string, newPath: string): Promise<IFile>; abstract renameFileOrFolder(fileId: string, newName: string): Promise<IFile>; abstract createFolder(path: string): Promise<IFile>; abstract readFolder(folderId: string): Promise<IFile[]>; abstract readRootFolder(): Promise<IFile[]>; abstract getSignedUrl(fileId: string, expires?: number): Promise<string>; abstract streamFile(fileId: string, range: string): Promise<PartialStream>; protected buildRange(range: string, file: IFile): { start: number; end: number; headers: Header206; }; }