Type definitions for s3rver

This commit is contained in:
David Broder-Rodgers
2015-12-24 14:42:51 +00:00
parent d8359c5a99
commit 5ae9f05103
2 changed files with 46 additions and 0 deletions

14
s3rver/s3rver-tests.ts Normal file
View File

@@ -0,0 +1,14 @@
/// <reference path="s3rver.d.ts" />
import S3rver = require('s3rver');
var s3rver = new S3rver({
port: 5694,
hostname: 'localhost',
silent: true,
indexDocument: 'index.html',
errorDocument: '',
directory: '/tmp/s3rver_test_directory'
}).run((err, hostname, port, directory) => {});
s3rver.close();

32
s3rver/s3rver.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
// Type definitions for S3rver
// Project: https://github.com/jamhall/s3rver
// Definitions by: David Broder-Rodgers <https://github.com/DavidBR-SW/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "s3rver" {
import * as http from "http";
class S3rver {
constructor(options: S3rverOptions)
setPort(port: number): S3rver;
setHostname(hostname: string): S3rver;
setDirectory(directory: string): S3rver;
setSilent(silent: boolean): S3rver;
setIndexDocument(indexDocument: string): S3rver;
setErrorDocument(errorDocument: string): S3rver;
run(callback: (error: Error, hostname: string, port: number, directory: string) => void): http.Server;
}
interface S3rverOptions {
port?: number;
hostname?: string;
silent?: boolean;
indexDocument?: string;
errorDocument?: string;
directory: string;
}
export = S3rver;
}