UNPKG

1.45 kBTypeScriptView Raw
1// Type definitions for S3rver
2// Project: https://github.com/jamhall/s3rver
3// Definitions by: David Broder-Rodgers <https://github.com/DavidBR-SW/>
4// F. Eugene Aumson <https://github.com/feuGeneA/>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6// TypeScript Version: 2.1
7
8/// <reference types="node" />
9
10declare class S3rver {
11 constructor(options: S3rverOptions)
12 setPort(port: number): S3rver;
13 setHostname(hostname: string): S3rver;
14 setDirectory(directory: string): S3rver;
15 setSilent(silent: boolean): S3rver;
16 setIndexDocument(indexDocument: string): S3rver;
17 setErrorDocument(errorDocument: string): S3rver;
18 run(callback: (error: Error | null, hostname: string, port: number, directory: string) => void): S3rver;
19 run(): Promise<string>;
20 close(): Promise<void>;
21 // Should return S3rver, but doesn't in all cases, currently
22 // See https://github.com/jamhall/s3rver/pull/571
23 close(callback: (error: Error | null) => void): void;
24}
25
26interface S3rverOptions {
27 port?: number;
28 hostname?: string;
29 address?: string;
30 silent?: boolean;
31 key?: string | Buffer;
32 cert?: string | Buffer;
33 resetOnClose?: boolean;
34 indexDocument?: string;
35 errorDocument?: string;
36 configureBuckets?: S3rverBucketConfig[];
37 directory: string;
38}
39
40interface S3rverBucketConfig {
41 name: string;
42 configs: string[] | Buffer[];
43}
44
45export = S3rver;