/
index.d.ts
31 lines (25 loc) · 956 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Type definitions for ghost-storage-base 0.0
// Project: https://github.com/TryGhost/Ghost-Storage-Base
// Definitions by: Demian <https://github.com/thde>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Handler } from 'express';
export interface Image {
path: string;
name: string;
type: string;
}
export interface ReadOptions {
path: string;
}
export abstract class StorageBase {
constructor();
abstract exists(fileName: string, targetDir?: string): Promise<boolean>;
abstract save(image: Image, targetDir?: string): Promise<string>;
abstract serve(): Handler;
abstract delete(fileName: string, targetDir?: string): Promise<boolean>;
abstract read(options?: ReadOptions): Promise<Buffer>;
getTargetDir(baseDir?: string): string;
getUniqueFileName(image: Image, targetDir: string): string;
getSanitizedFileName(fileName: string): string;
}