1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | declare var process: NodeJS.Process;
|
18 | declare var global: any;
|
19 |
|
20 | declare var __filename: string;
|
21 | declare var __dirname: string;
|
22 |
|
23 | declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
24 | declare function clearTimeout(timeoutId: NodeJS.Timer): void;
|
25 | declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
26 | declare function clearInterval(intervalId: NodeJS.Timer): void;
|
27 | declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
|
28 | declare function clearImmediate(immediateId: any): void;
|
29 |
|
30 | declare var require: {
|
31 | (id: string): any;
|
32 | resolve(id:string): string;
|
33 | cache: any;
|
34 | extensions: any;
|
35 | main: any;
|
36 | };
|
37 |
|
38 | declare var module: {
|
39 | exports: any;
|
40 | require(id: string): any;
|
41 | id: string;
|
42 | filename: string;
|
43 | loaded: boolean;
|
44 | parent: any;
|
45 | children: any[];
|
46 | };
|
47 |
|
48 |
|
49 | declare var exports: any;
|
50 | declare var SlowBuffer: {
|
51 | new (str: string, encoding?: string): Buffer;
|
52 | new (size: number): Buffer;
|
53 | new (size: Uint8Array): Buffer;
|
54 | new (array: any[]): Buffer;
|
55 | prototype: Buffer;
|
56 | isBuffer(obj: any): boolean;
|
57 | byteLength(string: string, encoding?: string): number;
|
58 | concat(list: Buffer[], totalLength?: number): Buffer;
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 | interface Buffer extends NodeBuffer {}
|
64 | declare var Buffer: {
|
65 | new (str: string, encoding?: string): Buffer;
|
66 | new (size: number): Buffer;
|
67 | new (size: Uint8Array): Buffer;
|
68 | new (array: any[]): Buffer;
|
69 | prototype: Buffer;
|
70 | isBuffer(obj: any): boolean;
|
71 | byteLength(string: string, encoding?: string): number;
|
72 | concat(list: Buffer[], totalLength?: number): Buffer;
|
73 | };
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | declare module NodeJS {
|
81 | export interface ErrnoException extends Error {
|
82 | errno?: any;
|
83 | code?: string;
|
84 | path?: string;
|
85 | syscall?: string;
|
86 | }
|
87 |
|
88 | export interface EventEmitter {
|
89 | addListener(event: string, listener: Function): EventEmitter;
|
90 | on(event: string, listener: Function): EventEmitter;
|
91 | once(event: string, listener: Function): EventEmitter;
|
92 | removeListener(event: string, listener: Function): EventEmitter;
|
93 | removeAllListeners(event?: string): EventEmitter;
|
94 | setMaxListeners(n: number): void;
|
95 | listeners(event: string): Function[];
|
96 | emit(event: string, ...args: any[]): boolean;
|
97 | }
|
98 |
|
99 | export interface ReadableStream extends EventEmitter {
|
100 | readable: boolean;
|
101 | read(size?: number): any;
|
102 | setEncoding(encoding: string): void;
|
103 | pause(): void;
|
104 | resume(): void;
|
105 | pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
106 | unpipe<T extends WritableStream>(destination?: T): void;
|
107 | unshift(chunk: string): void;
|
108 | unshift(chunk: Buffer): void;
|
109 | wrap(oldStream: ReadableStream): ReadableStream;
|
110 | }
|
111 |
|
112 | export interface WritableStream extends EventEmitter {
|
113 | writable: boolean;
|
114 | write(buffer: Buffer, cb?: Function): boolean;
|
115 | write(str: string, cb?: Function): boolean;
|
116 | write(str: string, encoding?: string, cb?: Function): boolean;
|
117 | end(): void;
|
118 | end(buffer: Buffer, cb?: Function): void;
|
119 | end(str: string, cb?: Function): void;
|
120 | end(str: string, encoding?: string, cb?: Function): void;
|
121 | }
|
122 |
|
123 | export interface ReadWriteStream extends ReadableStream, WritableStream {}
|
124 |
|
125 | export interface Process extends EventEmitter {
|
126 | stdout: WritableStream;
|
127 | stderr: WritableStream;
|
128 | stdin: ReadableStream;
|
129 | argv: string[];
|
130 | execPath: string;
|
131 | abort(): void;
|
132 | chdir(directory: string): void;
|
133 | cwd(): string;
|
134 | env: any;
|
135 | exit(code?: number): void;
|
136 | getgid(): number;
|
137 | setgid(id: number): void;
|
138 | setgid(id: string): void;
|
139 | getuid(): number;
|
140 | setuid(id: number): void;
|
141 | setuid(id: string): void;
|
142 | version: string;
|
143 | versions: {
|
144 | http_parser: string;
|
145 | node: string;
|
146 | v8: string;
|
147 | ares: string;
|
148 | uv: string;
|
149 | zlib: string;
|
150 | openssl: string;
|
151 | };
|
152 | config: {
|
153 | target_defaults: {
|
154 | cflags: any[];
|
155 | default_configuration: string;
|
156 | defines: string[];
|
157 | include_dirs: string[];
|
158 | libraries: string[];
|
159 | };
|
160 | variables: {
|
161 | clang: number;
|
162 | host_arch: string;
|
163 | node_install_npm: boolean;
|
164 | node_install_waf: boolean;
|
165 | node_prefix: string;
|
166 | node_shared_openssl: boolean;
|
167 | node_shared_v8: boolean;
|
168 | node_shared_zlib: boolean;
|
169 | node_use_dtrace: boolean;
|
170 | node_use_etw: boolean;
|
171 | node_use_openssl: boolean;
|
172 | target_arch: string;
|
173 | v8_no_strict_aliasing: number;
|
174 | v8_use_snapshot: boolean;
|
175 | visibility: string;
|
176 | };
|
177 | };
|
178 | kill(pid: number, signal?: string): void;
|
179 | pid: number;
|
180 | title: string;
|
181 | arch: string;
|
182 | platform: string;
|
183 | memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; };
|
184 | nextTick(callback: Function): void;
|
185 | umask(mask?: number): number;
|
186 | uptime(): number;
|
187 | hrtime(time?:number[]): number[];
|
188 |
|
189 |
|
190 | send?(message: any, sendHandle?: any): void;
|
191 | }
|
192 |
|
193 | export interface Timer {
|
194 | ref() : void;
|
195 | unref() : void;
|
196 | }
|
197 | }
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | interface NodeBuffer {
|
203 | [index: number]: number;
|
204 | write(string: string, offset?: number, length?: number, encoding?: string): number;
|
205 | toString(encoding?: string, start?: number, end?: number): string;
|
206 | toJSON(): any;
|
207 | length: number;
|
208 | copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
209 | slice(start?: number, end?: number): Buffer;
|
210 | readUInt8(offset: number, noAsset?: boolean): number;
|
211 | readUInt16LE(offset: number, noAssert?: boolean): number;
|
212 | readUInt16BE(offset: number, noAssert?: boolean): number;
|
213 | readUInt32LE(offset: number, noAssert?: boolean): number;
|
214 | readUInt32BE(offset: number, noAssert?: boolean): number;
|
215 | readInt8(offset: number, noAssert?: boolean): number;
|
216 | readInt16LE(offset: number, noAssert?: boolean): number;
|
217 | readInt16BE(offset: number, noAssert?: boolean): number;
|
218 | readInt32LE(offset: number, noAssert?: boolean): number;
|
219 | readInt32BE(offset: number, noAssert?: boolean): number;
|
220 | readFloatLE(offset: number, noAssert?: boolean): number;
|
221 | readFloatBE(offset: number, noAssert?: boolean): number;
|
222 | readDoubleLE(offset: number, noAssert?: boolean): number;
|
223 | readDoubleBE(offset: number, noAssert?: boolean): number;
|
224 | writeUInt8(value: number, offset: number, noAssert?: boolean): void;
|
225 | writeUInt16LE(value: number, offset: number, noAssert?: boolean): void;
|
226 | writeUInt16BE(value: number, offset: number, noAssert?: boolean): void;
|
227 | writeUInt32LE(value: number, offset: number, noAssert?: boolean): void;
|
228 | writeUInt32BE(value: number, offset: number, noAssert?: boolean): void;
|
229 | writeInt8(value: number, offset: number, noAssert?: boolean): void;
|
230 | writeInt16LE(value: number, offset: number, noAssert?: boolean): void;
|
231 | writeInt16BE(value: number, offset: number, noAssert?: boolean): void;
|
232 | writeInt32LE(value: number, offset: number, noAssert?: boolean): void;
|
233 | writeInt32BE(value: number, offset: number, noAssert?: boolean): void;
|
234 | writeFloatLE(value: number, offset: number, noAssert?: boolean): void;
|
235 | writeFloatBE(value: number, offset: number, noAssert?: boolean): void;
|
236 | writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
|
237 | writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
|
238 | fill(value: any, offset?: number, end?: number): void;
|
239 | }
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 | declare module "buffer" {
|
247 | export var INSPECT_MAX_BYTES: number;
|
248 | }
|
249 |
|
250 | declare module "querystring" {
|
251 | export function stringify(obj: any, sep?: string, eq?: string): string;
|
252 | export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any;
|
253 | export function escape(): any;
|
254 | export function unescape(): any;
|
255 | }
|
256 |
|
257 | declare module "events" {
|
258 | export class EventEmitter implements NodeJS.EventEmitter {
|
259 | static listenerCount(emitter: EventEmitter, event: string): number;
|
260 |
|
261 | addListener(event: string, listener: Function): EventEmitter;
|
262 | on(event: string, listener: Function): EventEmitter;
|
263 | once(event: string, listener: Function): EventEmitter;
|
264 | removeListener(event: string, listener: Function): EventEmitter;
|
265 | removeAllListeners(event?: string): EventEmitter;
|
266 | setMaxListeners(n: number): void;
|
267 | listeners(event: string): Function[];
|
268 | emit(event: string, ...args: any[]): boolean;
|
269 | }
|
270 | }
|
271 |
|
272 | declare module "http" {
|
273 | import events = require("events");
|
274 | import net = require("net");
|
275 | import stream = require("stream");
|
276 |
|
277 | export interface Server extends events.EventEmitter {
|
278 | listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
|
279 | listen(path: string, callback?: Function): Server;
|
280 | listen(handle: any, listeningListener?: Function): Server;
|
281 | close(cb?: any): Server;
|
282 | address(): { port: number; family: string; address: string; };
|
283 | maxHeadersCount: number;
|
284 | }
|
285 | export interface ServerRequest extends events.EventEmitter, stream.Readable {
|
286 | method: string;
|
287 | url: string;
|
288 | headers: any;
|
289 | trailers: string;
|
290 | httpVersion: string;
|
291 | setEncoding(encoding?: string): void;
|
292 | pause(): void;
|
293 | resume(): void;
|
294 | connection: net.Socket;
|
295 | }
|
296 | export interface ServerResponse extends events.EventEmitter, stream.Writable {
|
297 |
|
298 | write(buffer: Buffer): boolean;
|
299 | write(buffer: Buffer, cb?: Function): boolean;
|
300 | write(str: string, cb?: Function): boolean;
|
301 | write(str: string, encoding?: string, cb?: Function): boolean;
|
302 | write(str: string, encoding?: string, fd?: string): boolean;
|
303 |
|
304 | writeContinue(): void;
|
305 | writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void;
|
306 | writeHead(statusCode: number, headers?: any): void;
|
307 | statusCode: number;
|
308 | setHeader(name: string, value: string): void;
|
309 | sendDate: boolean;
|
310 | getHeader(name: string): string;
|
311 | removeHeader(name: string): void;
|
312 | write(chunk: any, encoding?: string): any;
|
313 | addTrailers(headers: any): void;
|
314 |
|
315 |
|
316 | end(): void;
|
317 | end(buffer: Buffer, cb?: Function): void;
|
318 | end(str: string, cb?: Function): void;
|
319 | end(str: string, encoding?: string, cb?: Function): void;
|
320 | end(data?: any, encoding?: string): void;
|
321 | }
|
322 | export interface ClientRequest extends events.EventEmitter, stream.Writable {
|
323 |
|
324 | write(buffer: Buffer): boolean;
|
325 | write(buffer: Buffer, cb?: Function): boolean;
|
326 | write(str: string, cb?: Function): boolean;
|
327 | write(str: string, encoding?: string, cb?: Function): boolean;
|
328 | write(str: string, encoding?: string, fd?: string): boolean;
|
329 |
|
330 | write(chunk: any, encoding?: string): void;
|
331 | abort(): void;
|
332 | setTimeout(timeout: number, callback?: Function): void;
|
333 | setNoDelay(noDelay?: boolean): void;
|
334 | setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
|
335 |
|
336 |
|
337 | end(): void;
|
338 | end(buffer: Buffer, cb?: Function): void;
|
339 | end(str: string, cb?: Function): void;
|
340 | end(str: string, encoding?: string, cb?: Function): void;
|
341 | end(data?: any, encoding?: string): void;
|
342 | }
|
343 | export interface ClientResponse extends events.EventEmitter, stream.Readable {
|
344 | statusCode: number;
|
345 | httpVersion: string;
|
346 | headers: any;
|
347 | trailers: any;
|
348 | setEncoding(encoding?: string): void;
|
349 | pause(): void;
|
350 | resume(): void;
|
351 | }
|
352 | export interface Agent { maxSockets: number; sockets: any; requests: any; }
|
353 |
|
354 | export var STATUS_CODES: {
|
355 | [errorCode: number]: string;
|
356 | [errorCode: string]: string;
|
357 | };
|
358 | export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) =>void ): Server;
|
359 | export function createClient(port?: number, host?: string): any;
|
360 | export function request(options: any, callback?: Function): ClientRequest;
|
361 | export function get(options: any, callback?: Function): ClientRequest;
|
362 | export var globalAgent: Agent;
|
363 | }
|
364 |
|
365 | declare module "cluster" {
|
366 | import child = require("child_process");
|
367 | import events = require("events");
|
368 |
|
369 | export interface ClusterSettings {
|
370 | exec?: string;
|
371 | args?: string[];
|
372 | silent?: boolean;
|
373 | }
|
374 |
|
375 | export class Worker extends events.EventEmitter {
|
376 | id: string;
|
377 | process: child.ChildProcess;
|
378 | suicide: boolean;
|
379 | send(message: any, sendHandle?: any): void;
|
380 | kill(signal?: string): void;
|
381 | destroy(signal?: string): void;
|
382 | disconnect(): void;
|
383 | }
|
384 |
|
385 | export var settings: ClusterSettings;
|
386 | export var isMaster: boolean;
|
387 | export var isWorker: boolean;
|
388 | export function setupMaster(settings?: ClusterSettings): void;
|
389 | export function fork(env?: any): Worker;
|
390 | export function disconnect(callback?: Function): void;
|
391 | export var worker: Worker;
|
392 | export var workers: Worker[];
|
393 |
|
394 |
|
395 | export function addListener(event: string, listener: Function): void;
|
396 | export function on(event: string, listener: Function): any;
|
397 | export function once(event: string, listener: Function): void;
|
398 | export function removeListener(event: string, listener: Function): void;
|
399 | export function removeAllListeners(event?: string): void;
|
400 | export function setMaxListeners(n: number): void;
|
401 | export function listeners(event: string): Function[];
|
402 | export function emit(event: string, ...args: any[]): boolean;
|
403 | }
|
404 |
|
405 | declare module "zlib" {
|
406 | import stream = require("stream");
|
407 | export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; }
|
408 |
|
409 | export interface Gzip extends stream.Transform { }
|
410 | export interface Gunzip extends stream.Transform { }
|
411 | export interface Deflate extends stream.Transform { }
|
412 | export interface Inflate extends stream.Transform { }
|
413 | export interface DeflateRaw extends stream.Transform { }
|
414 | export interface InflateRaw extends stream.Transform { }
|
415 | export interface Unzip extends stream.Transform { }
|
416 |
|
417 | export function createGzip(options?: ZlibOptions): Gzip;
|
418 | export function createGunzip(options?: ZlibOptions): Gunzip;
|
419 | export function createDeflate(options?: ZlibOptions): Deflate;
|
420 | export function createInflate(options?: ZlibOptions): Inflate;
|
421 | export function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
|
422 | export function createInflateRaw(options?: ZlibOptions): InflateRaw;
|
423 | export function createUnzip(options?: ZlibOptions): Unzip;
|
424 |
|
425 | export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
426 | export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
427 | export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
428 | export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
429 | export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
430 | export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
431 | export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
432 |
|
433 |
|
434 | export var Z_NO_FLUSH: number;
|
435 | export var Z_PARTIAL_FLUSH: number;
|
436 | export var Z_SYNC_FLUSH: number;
|
437 | export var Z_FULL_FLUSH: number;
|
438 | export var Z_FINISH: number;
|
439 | export var Z_BLOCK: number;
|
440 | export var Z_TREES: number;
|
441 | export var Z_OK: number;
|
442 | export var Z_STREAM_END: number;
|
443 | export var Z_NEED_DICT: number;
|
444 | export var Z_ERRNO: number;
|
445 | export var Z_STREAM_ERROR: number;
|
446 | export var Z_DATA_ERROR: number;
|
447 | export var Z_MEM_ERROR: number;
|
448 | export var Z_BUF_ERROR: number;
|
449 | export var Z_VERSION_ERROR: number;
|
450 | export var Z_NO_COMPRESSION: number;
|
451 | export var Z_BEST_SPEED: number;
|
452 | export var Z_BEST_COMPRESSION: number;
|
453 | export var Z_DEFAULT_COMPRESSION: number;
|
454 | export var Z_FILTERED: number;
|
455 | export var Z_HUFFMAN_ONLY: number;
|
456 | export var Z_RLE: number;
|
457 | export var Z_FIXED: number;
|
458 | export var Z_DEFAULT_STRATEGY: number;
|
459 | export var Z_BINARY: number;
|
460 | export var Z_TEXT: number;
|
461 | export var Z_ASCII: number;
|
462 | export var Z_UNKNOWN: number;
|
463 | export var Z_DEFLATED: number;
|
464 | export var Z_NULL: number;
|
465 | }
|
466 |
|
467 | declare module "os" {
|
468 | export function tmpdir(): string;
|
469 | export function hostname(): string;
|
470 | export function type(): string;
|
471 | export function platform(): string;
|
472 | export function arch(): string;
|
473 | export function release(): string;
|
474 | export function uptime(): number;
|
475 | export function loadavg(): number[];
|
476 | export function totalmem(): number;
|
477 | export function freemem(): number;
|
478 | export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[];
|
479 | export function networkInterfaces(): any;
|
480 | export var EOL: string;
|
481 | }
|
482 |
|
483 | declare module "https" {
|
484 | import tls = require("tls");
|
485 | import events = require("events");
|
486 | import http = require("http");
|
487 |
|
488 | export interface ServerOptions {
|
489 | pfx?: any;
|
490 | key?: any;
|
491 | passphrase?: string;
|
492 | cert?: any;
|
493 | ca?: any;
|
494 | crl?: any;
|
495 | ciphers?: string;
|
496 | honorCipherOrder?: boolean;
|
497 | requestCert?: boolean;
|
498 | rejectUnauthorized?: boolean;
|
499 | NPNProtocols?: any;
|
500 | SNICallback?: (servername: string) => any;
|
501 | }
|
502 |
|
503 | export interface RequestOptions {
|
504 | host?: string;
|
505 | hostname?: string;
|
506 | port?: number;
|
507 | path?: string;
|
508 | method?: string;
|
509 | headers?: any;
|
510 | auth?: string;
|
511 | agent?: any;
|
512 | pfx?: any;
|
513 | key?: any;
|
514 | passphrase?: string;
|
515 | cert?: any;
|
516 | ca?: any;
|
517 | ciphers?: string;
|
518 | rejectUnauthorized?: boolean;
|
519 | }
|
520 |
|
521 | export interface Agent {
|
522 | maxSockets: number;
|
523 | sockets: any;
|
524 | requests: any;
|
525 | }
|
526 | export var Agent: {
|
527 | new (options?: RequestOptions): Agent;
|
528 | };
|
529 | export interface Server extends tls.Server { }
|
530 | export function createServer(options: ServerOptions, requestListener?: Function): Server;
|
531 | export function request(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest;
|
532 | export function get(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest;
|
533 | export var globalAgent: Agent;
|
534 | }
|
535 |
|
536 | declare module "punycode" {
|
537 | export function decode(string: string): string;
|
538 | export function encode(string: string): string;
|
539 | export function toUnicode(domain: string): string;
|
540 | export function toASCII(domain: string): string;
|
541 | export var ucs2: ucs2;
|
542 | interface ucs2 {
|
543 | decode(string: string): string;
|
544 | encode(codePoints: number[]): string;
|
545 | }
|
546 | export var version: any;
|
547 | }
|
548 |
|
549 | declare module "repl" {
|
550 | import stream = require("stream");
|
551 | import events = require("events");
|
552 |
|
553 | export interface ReplOptions {
|
554 | prompt?: string;
|
555 | input?: NodeJS.ReadableStream;
|
556 | output?: NodeJS.WritableStream;
|
557 | terminal?: boolean;
|
558 | eval?: Function;
|
559 | useColors?: boolean;
|
560 | useGlobal?: boolean;
|
561 | ignoreUndefined?: boolean;
|
562 | writer?: Function;
|
563 | }
|
564 | export function start(options: ReplOptions): events.EventEmitter;
|
565 | }
|
566 |
|
567 | declare module "readline" {
|
568 | import events = require("events");
|
569 | import stream = require("stream");
|
570 |
|
571 | export interface ReadLine extends events.EventEmitter {
|
572 | setPrompt(prompt: string, length: number): void;
|
573 | prompt(preserveCursor?: boolean): void;
|
574 | question(query: string, callback: Function): void;
|
575 | pause(): void;
|
576 | resume(): void;
|
577 | close(): void;
|
578 | write(data: any, key?: any): void;
|
579 | }
|
580 | export interface ReadLineOptions {
|
581 | input: NodeJS.ReadableStream;
|
582 | output: NodeJS.WritableStream;
|
583 | completer?: Function;
|
584 | terminal?: boolean;
|
585 | }
|
586 | export function createInterface(options: ReadLineOptions): ReadLine;
|
587 | }
|
588 |
|
589 | declare module "vm" {
|
590 | export interface Context { }
|
591 | export interface Script {
|
592 | runInThisContext(): void;
|
593 | runInNewContext(sandbox?: Context): void;
|
594 | }
|
595 | export function runInThisContext(code: string, filename?: string): void;
|
596 | export function runInNewContext(code: string, sandbox?: Context, filename?: string): void;
|
597 | export function runInContext(code: string, context: Context, filename?: string): void;
|
598 | export function createContext(initSandbox?: Context): Context;
|
599 | export function createScript(code: string, filename?: string): Script;
|
600 | }
|
601 |
|
602 | declare module "child_process" {
|
603 | import events = require("events");
|
604 | import stream = require("stream");
|
605 |
|
606 | export interface ChildProcess extends events.EventEmitter {
|
607 | stdin: stream.Writable;
|
608 | stdout: stream.Readable;
|
609 | stderr: stream.Readable;
|
610 | pid: number;
|
611 | kill(signal?: string): void;
|
612 | send(message: any, sendHandle: any): void;
|
613 | disconnect(): void;
|
614 | }
|
615 |
|
616 | export function spawn(command: string, args?: string[], options?: {
|
617 | cwd?: string;
|
618 | stdio?: any;
|
619 | custom?: any;
|
620 | env?: any;
|
621 | detached?: boolean;
|
622 | }): ChildProcess;
|
623 | export function exec(command: string, options: {
|
624 | cwd?: string;
|
625 | stdio?: any;
|
626 | customFds?: any;
|
627 | env?: any;
|
628 | encoding?: string;
|
629 | timeout?: number;
|
630 | maxBuffer?: number;
|
631 | killSignal?: string;
|
632 | }, callback: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
633 | export function exec(command: string, callback: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
634 | export function execFile(file: string,
|
635 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
636 | export function execFile(file: string, args?: string[],
|
637 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
638 | export function execFile(file: string, args?: string[], options?: {
|
639 | cwd?: string;
|
640 | stdio?: any;
|
641 | customFds?: any;
|
642 | env?: any;
|
643 | encoding?: string;
|
644 | timeout?: number;
|
645 | maxBuffer?: string;
|
646 | killSignal?: string;
|
647 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
648 | export function fork(modulePath: string, args?: string[], options?: {
|
649 | cwd?: string;
|
650 | env?: any;
|
651 | encoding?: string;
|
652 | }): ChildProcess;
|
653 | }
|
654 |
|
655 | declare module "url" {
|
656 | export interface Url {
|
657 | href: string;
|
658 | protocol: string;
|
659 | auth: string;
|
660 | hostname: string;
|
661 | port: string;
|
662 | host: string;
|
663 | pathname: string;
|
664 | search: string;
|
665 | query: any;
|
666 | slashes: boolean;
|
667 | hash?: string;
|
668 | path?: string;
|
669 | }
|
670 |
|
671 | export interface UrlOptions {
|
672 | protocol?: string;
|
673 | auth?: string;
|
674 | hostname?: string;
|
675 | port?: string;
|
676 | host?: string;
|
677 | pathname?: string;
|
678 | search?: string;
|
679 | query?: any;
|
680 | hash?: string;
|
681 | path?: string;
|
682 | }
|
683 |
|
684 | export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
685 | export function format(url: UrlOptions): string;
|
686 | export function resolve(from: string, to: string): string;
|
687 | }
|
688 |
|
689 | declare module "dns" {
|
690 | export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string;
|
691 | export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string;
|
692 | export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
693 | export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
694 | export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
695 | export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
696 | export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
697 | export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
698 | export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
699 | export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
700 | export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
701 | export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[];
|
702 | }
|
703 |
|
704 | declare module "net" {
|
705 | import stream = require("stream");
|
706 |
|
707 | export interface Socket extends stream.Duplex {
|
708 |
|
709 | write(buffer: Buffer): boolean;
|
710 | write(buffer: Buffer, cb?: Function): boolean;
|
711 | write(str: string, cb?: Function): boolean;
|
712 | write(str: string, encoding?: string, cb?: Function): boolean;
|
713 | write(str: string, encoding?: string, fd?: string): boolean;
|
714 |
|
715 | connect(port: number, host?: string, connectionListener?: Function): void;
|
716 | connect(path: string, connectionListener?: Function): void;
|
717 | bufferSize: number;
|
718 | setEncoding(encoding?: string): void;
|
719 | write(data: any, encoding?: string, callback?: Function): void;
|
720 | destroy(): void;
|
721 | pause(): void;
|
722 | resume(): void;
|
723 | setTimeout(timeout: number, callback?: Function): void;
|
724 | setNoDelay(noDelay?: boolean): void;
|
725 | setKeepAlive(enable?: boolean, initialDelay?: number): void;
|
726 | address(): { port: number; family: string; address: string; };
|
727 | unref(): void;
|
728 | ref(): void;
|
729 |
|
730 | remoteAddress: string;
|
731 | remotePort: number;
|
732 | bytesRead: number;
|
733 | bytesWritten: number;
|
734 |
|
735 |
|
736 | end(): void;
|
737 | end(buffer: Buffer, cb?: Function): void;
|
738 | end(str: string, cb?: Function): void;
|
739 | end(str: string, encoding?: string, cb?: Function): void;
|
740 | end(data?: any, encoding?: string): void;
|
741 | }
|
742 |
|
743 | export var Socket: {
|
744 | new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket;
|
745 | };
|
746 |
|
747 | export interface Server extends Socket {
|
748 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server;
|
749 | listen(path: string, listeningListener?: Function): Server;
|
750 | listen(handle: any, listeningListener?: Function): Server;
|
751 | close(callback?: Function): Server;
|
752 | address(): { port: number; family: string; address: string; };
|
753 | maxConnections: number;
|
754 | connections: number;
|
755 | }
|
756 | export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
|
757 | export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
|
758 | export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
759 | export function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
760 | export function connect(path: string, connectionListener?: Function): Socket;
|
761 | export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
762 | export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
763 | export function createConnection(path: string, connectionListener?: Function): Socket;
|
764 | export function isIP(input: string): number;
|
765 | export function isIPv4(input: string): boolean;
|
766 | export function isIPv6(input: string): boolean;
|
767 | }
|
768 |
|
769 | declare module "dgram" {
|
770 | import events = require("events");
|
771 |
|
772 | interface RemoteInfo {
|
773 | address: string;
|
774 | port: number;
|
775 | size: number;
|
776 | }
|
777 |
|
778 | interface AddressInfo {
|
779 | address: string;
|
780 | family: string;
|
781 | port: number;
|
782 | }
|
783 |
|
784 | export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
785 |
|
786 | interface Socket extends events.EventEmitter {
|
787 | send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
|
788 | bind(port: number, address?: string, callback?: () => void): void;
|
789 | close(): void;
|
790 | address(): AddressInfo;
|
791 | setBroadcast(flag: boolean): void;
|
792 | setMulticastTTL(ttl: number): void;
|
793 | setMulticastLoopback(flag: boolean): void;
|
794 | addMembership(multicastAddress: string, multicastInterface?: string): void;
|
795 | dropMembership(multicastAddress: string, multicastInterface?: string): void;
|
796 | }
|
797 | }
|
798 |
|
799 | declare module "fs" {
|
800 | import stream = require("stream");
|
801 | import events = require("events");
|
802 |
|
803 | interface Stats {
|
804 | isFile(): boolean;
|
805 | isDirectory(): boolean;
|
806 | isBlockDevice(): boolean;
|
807 | isCharacterDevice(): boolean;
|
808 | isSymbolicLink(): boolean;
|
809 | isFIFO(): boolean;
|
810 | isSocket(): boolean;
|
811 | dev: number;
|
812 | ino: number;
|
813 | mode: number;
|
814 | nlink: number;
|
815 | uid: number;
|
816 | gid: number;
|
817 | rdev: number;
|
818 | size: number;
|
819 | blksize: number;
|
820 | blocks: number;
|
821 | atime: Date;
|
822 | mtime: Date;
|
823 | ctime: Date;
|
824 | }
|
825 |
|
826 | interface FSWatcher extends events.EventEmitter {
|
827 | close(): void;
|
828 | }
|
829 |
|
830 | export interface ReadStream extends stream.Readable {
|
831 | close(): void;
|
832 | }
|
833 | export interface WriteStream extends stream.Writable {
|
834 | close(): void;
|
835 | }
|
836 |
|
837 | export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
838 | export function renameSync(oldPath: string, newPath: string): void;
|
839 | export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
840 | export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
841 | export function truncateSync(path: string, len?: number): void;
|
842 | export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
843 | export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
844 | export function ftruncateSync(fd: number, len?: number): void;
|
845 | export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
846 | export function chownSync(path: string, uid: number, gid: number): void;
|
847 | export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
848 | export function fchownSync(fd: number, uid: number, gid: number): void;
|
849 | export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
850 | export function lchownSync(path: string, uid: number, gid: number): void;
|
851 | export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
852 | export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
853 | export function chmodSync(path: string, mode: number): void;
|
854 | export function chmodSync(path: string, mode: string): void;
|
855 | export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
856 | export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
857 | export function fchmodSync(fd: number, mode: number): void;
|
858 | export function fchmodSync(fd: number, mode: string): void;
|
859 | export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
860 | export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
861 | export function lchmodSync(path: string, mode: number): void;
|
862 | export function lchmodSync(path: string, mode: string): void;
|
863 | export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
864 | export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
865 | export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
866 | export function statSync(path: string): Stats;
|
867 | export function lstatSync(path: string): Stats;
|
868 | export function fstatSync(fd: number): Stats;
|
869 | export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
870 | export function linkSync(srcpath: string, dstpath: string): void;
|
871 | export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
872 | export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
|
873 | export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
874 | export function readlinkSync(path: string): string;
|
875 | export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
876 | export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void;
|
877 | export function realpathSync(path: string, cache?: {[path: string]: string}): string;
|
878 | export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
879 | export function unlinkSync(path: string): void;
|
880 | export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
881 | export function rmdirSync(path: string): void;
|
882 | export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
883 | export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
884 | export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
885 | export function mkdirSync(path: string, mode?: number): void;
|
886 | export function mkdirSync(path: string, mode?: string): void;
|
887 | export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
888 | export function readdirSync(path: string): string[];
|
889 | export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
890 | export function closeSync(fd: number): void;
|
891 | export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
892 | export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
893 | export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
894 | export function openSync(path: string, flags: string, mode?: number): number;
|
895 | export function openSync(path: string, flags: string, mode?: string): number;
|
896 | export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
897 | export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
898 | export function utimesSync(path: string, atime: number, mtime: number): void;
|
899 | export function utimesSync(path: string, atime: Date, mtime: Date): void;
|
900 | export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
901 | export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
902 | export function futimesSync(fd: number, atime: number, mtime: number): void;
|
903 | export function futimesSync(fd: number, atime: Date, mtime: Date): void;
|
904 | export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
905 | export function fsyncSync(fd: number): void;
|
906 | export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
907 | export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
908 | export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
909 | export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
910 | export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
911 | export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
912 | export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
913 | export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void ): void;
|
914 | export function readFileSync(filename: string, encoding: string): string;
|
915 | export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string;
|
916 | export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
|
917 | export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
918 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
919 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
920 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
921 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
922 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
923 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
924 | export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
925 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
926 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
927 | export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;
|
928 | export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
|
929 | export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
|
930 | export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
931 | export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
|
932 | export function exists(path: string, callback?: (exists: boolean) => void): void;
|
933 | export function existsSync(path: string): boolean;
|
934 | export function createReadStream(path: string, options?: {
|
935 | flags?: string;
|
936 | encoding?: string;
|
937 | fd?: string;
|
938 | mode?: number;
|
939 | bufferSize?: number;
|
940 | }): ReadStream;
|
941 | export function createReadStream(path: string, options?: {
|
942 | flags?: string;
|
943 | encoding?: string;
|
944 | fd?: string;
|
945 | mode?: string;
|
946 | bufferSize?: number;
|
947 | }): ReadStream;
|
948 | export function createWriteStream(path: string, options?: {
|
949 | flags?: string;
|
950 | encoding?: string;
|
951 | string?: string;
|
952 | }): WriteStream;
|
953 | }
|
954 |
|
955 | declare module "path" {
|
956 | export function normalize(p: string): string;
|
957 | export function join(...paths: any[]): string;
|
958 | export function resolve(...pathSegments: any[]): string;
|
959 | export function relative(from: string, to: string): string;
|
960 | export function dirname(p: string): string;
|
961 | export function basename(p: string, ext?: string): string;
|
962 | export function extname(p: string): string;
|
963 | export var sep: string;
|
964 | }
|
965 |
|
966 | declare module "string_decoder" {
|
967 | export interface NodeStringDecoder {
|
968 | write(buffer: Buffer): string;
|
969 | detectIncompleteChar(buffer: Buffer): number;
|
970 | }
|
971 | export var StringDecoder: {
|
972 | new (encoding: string): NodeStringDecoder;
|
973 | };
|
974 | }
|
975 |
|
976 | declare module "tls" {
|
977 | import crypto = require("crypto");
|
978 | import net = require("net");
|
979 | import stream = require("stream");
|
980 |
|
981 | var CLIENT_RENEG_LIMIT: number;
|
982 | var CLIENT_RENEG_WINDOW: number;
|
983 |
|
984 | export interface TlsOptions {
|
985 | pfx?: any;
|
986 | key?: any;
|
987 | passphrase?: string;
|
988 | cert?: any;
|
989 | ca?: any;
|
990 | crl?: any;
|
991 | ciphers?: string;
|
992 | honorCipherOrder?: any;
|
993 | requestCert?: boolean;
|
994 | rejectUnauthorized?: boolean;
|
995 | NPNProtocols?: any;
|
996 | SNICallback?: (servername: string) => any;
|
997 | }
|
998 |
|
999 | export interface ConnectionOptions {
|
1000 | host?: string;
|
1001 | port?: number;
|
1002 | socket?: net.Socket;
|
1003 | pfx?: any;
|
1004 | key?: any;
|
1005 | passphrase?: string;
|
1006 | cert?: any;
|
1007 | ca?: any;
|
1008 | rejectUnauthorized?: boolean;
|
1009 | NPNProtocols?: any;
|
1010 | servername?: string;
|
1011 | }
|
1012 |
|
1013 | export interface Server extends net.Server {
|
1014 |
|
1015 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server;
|
1016 | listen(path: string, listeningListener?: Function): Server;
|
1017 | listen(handle: any, listeningListener?: Function): Server;
|
1018 |
|
1019 | listen(port: number, host?: string, callback?: Function): Server;
|
1020 | close(): Server;
|
1021 | address(): { port: number; family: string; address: string; };
|
1022 | addContext(hostName: string, credentials: {
|
1023 | key: string;
|
1024 | cert: string;
|
1025 | ca: string;
|
1026 | }): void;
|
1027 | maxConnections: number;
|
1028 | connections: number;
|
1029 | }
|
1030 |
|
1031 | export interface ClearTextStream extends stream.Duplex {
|
1032 | authorized: boolean;
|
1033 | authorizationError: Error;
|
1034 | getPeerCertificate(): any;
|
1035 | getCipher: {
|
1036 | name: string;
|
1037 | version: string;
|
1038 | };
|
1039 | address: {
|
1040 | port: number;
|
1041 | family: string;
|
1042 | address: string;
|
1043 | };
|
1044 | remoteAddress: string;
|
1045 | remotePort: number;
|
1046 | }
|
1047 |
|
1048 | export interface SecurePair {
|
1049 | encrypted: any;
|
1050 | cleartext: any;
|
1051 | }
|
1052 |
|
1053 | export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server;
|
1054 | export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream;
|
1055 | export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
1056 | export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
1057 | export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
1058 | }
|
1059 |
|
1060 | declare module "crypto" {
|
1061 | export interface CredentialDetails {
|
1062 | pfx: string;
|
1063 | key: string;
|
1064 | passphrase: string;
|
1065 | cert: string;
|
1066 | ca: any;
|
1067 | crl: any;
|
1068 | ciphers: string;
|
1069 | }
|
1070 | export interface Credentials { context?: any; }
|
1071 | export function createCredentials(details: CredentialDetails): Credentials;
|
1072 | export function createHash(algorithm: string): Hash;
|
1073 | export function createHmac(algorithm: string, key: string): Hmac;
|
1074 | export function createHmac(algorithm: string, key: Buffer): Hmac;
|
1075 | interface Hash {
|
1076 | update(data: any, input_encoding?: string): Hash;
|
1077 | digest(encoding: 'buffer'): Buffer;
|
1078 | digest(encoding: string): any;
|
1079 | digest(): Buffer;
|
1080 | }
|
1081 | interface Hmac {
|
1082 | update(data: any, input_encoding?: string): Hmac;
|
1083 | digest(encoding: 'buffer'): Buffer;
|
1084 | digest(encoding: string): any;
|
1085 | digest(): Buffer;
|
1086 | }
|
1087 | export function createCipher(algorithm: string, password: any): Cipher;
|
1088 | export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
1089 | interface Cipher {
|
1090 | update(data: Buffer): Buffer;
|
1091 | update(data: string, input_encoding?: string, output_encoding?: string): string;
|
1092 | final(): Buffer;
|
1093 | final(output_encoding: string): string;
|
1094 | setAutoPadding(auto_padding: boolean): void;
|
1095 | }
|
1096 | export function createDecipher(algorithm: string, password: any): Decipher;
|
1097 | export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
1098 | interface Decipher {
|
1099 | update(data: Buffer): Buffer;
|
1100 | update(data: string, input_encoding?: string, output_encoding?: string): string;
|
1101 | final(): Buffer;
|
1102 | final(output_encoding: string): string;
|
1103 | setAutoPadding(auto_padding: boolean): void;
|
1104 | }
|
1105 | export function createSign(algorithm: string): Signer;
|
1106 | interface Signer {
|
1107 | update(data: any): void;
|
1108 | sign(private_key: string, output_format: string): string;
|
1109 | }
|
1110 | export function createVerify(algorith: string): Verify;
|
1111 | interface Verify {
|
1112 | update(data: any): void;
|
1113 | verify(object: string, signature: string, signature_format?: string): boolean;
|
1114 | }
|
1115 | export function createDiffieHellman(prime_length: number): DiffieHellman;
|
1116 | export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
|
1117 | interface DiffieHellman {
|
1118 | generateKeys(encoding?: string): string;
|
1119 | computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
|
1120 | getPrime(encoding?: string): string;
|
1121 | getGenerator(encoding: string): string;
|
1122 | getPublicKey(encoding?: string): string;
|
1123 | getPrivateKey(encoding?: string): string;
|
1124 | setPublicKey(public_key: string, encoding?: string): void;
|
1125 | setPrivateKey(public_key: string, encoding?: string): void;
|
1126 | }
|
1127 | export function getDiffieHellman(group_name: string): DiffieHellman;
|
1128 | export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
1129 | export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer;
|
1130 | export function randomBytes(size: number): Buffer;
|
1131 | export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
1132 | export function pseudoRandomBytes(size: number): Buffer;
|
1133 | export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
1134 | }
|
1135 |
|
1136 | declare module "stream" {
|
1137 | import events = require("events");
|
1138 |
|
1139 | export interface Stream extends events.EventEmitter {
|
1140 | pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
1141 | }
|
1142 |
|
1143 | export interface ReadableOptions {
|
1144 | highWaterMark?: number;
|
1145 | encoding?: string;
|
1146 | objectMode?: boolean;
|
1147 | }
|
1148 |
|
1149 | export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
1150 | readable: boolean;
|
1151 | constructor(opts?: ReadableOptions);
|
1152 | _read(size: number): void;
|
1153 | read(size?: number): any;
|
1154 | setEncoding(encoding: string): void;
|
1155 | pause(): void;
|
1156 | resume(): void;
|
1157 | pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
1158 | unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
1159 | unshift(chunk: string): void;
|
1160 | unshift(chunk: Buffer): void;
|
1161 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
1162 | push(chunk: any, encoding?: string): boolean;
|
1163 | }
|
1164 |
|
1165 | export interface WritableOptions {
|
1166 | highWaterMark?: number;
|
1167 | decodeStrings?: boolean;
|
1168 | }
|
1169 |
|
1170 | export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
1171 | writable: boolean;
|
1172 | constructor(opts?: WritableOptions);
|
1173 | _write(data: Buffer, encoding: string, callback: Function): void;
|
1174 | _write(data: string, encoding: string, callback: Function): void;
|
1175 | write(buffer: Buffer, cb?: Function): boolean;
|
1176 | write(str: string, cb?: Function): boolean;
|
1177 | write(str: string, encoding?: string, cb?: Function): boolean;
|
1178 | end(): void;
|
1179 | end(buffer: Buffer, cb?: Function): void;
|
1180 | end(str: string, cb?: Function): void;
|
1181 | end(str: string, encoding?: string, cb?: Function): void;
|
1182 | }
|
1183 |
|
1184 | export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
1185 | allowHalfOpen?: boolean;
|
1186 | }
|
1187 |
|
1188 |
|
1189 | export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
1190 | writable: boolean;
|
1191 | constructor(opts?: DuplexOptions);
|
1192 | _write(data: Buffer, encoding: string, callback: Function): void;
|
1193 | _write(data: string, encoding: string, callback: Function): void;
|
1194 | write(buffer: Buffer, cb?: Function): boolean;
|
1195 | write(str: string, cb?: Function): boolean;
|
1196 | write(str: string, encoding?: string, cb?: Function): boolean;
|
1197 | end(): void;
|
1198 | end(buffer: Buffer, cb?: Function): void;
|
1199 | end(str: string, cb?: Function): void;
|
1200 | end(str: string, encoding?: string, cb?: Function): void;
|
1201 | }
|
1202 |
|
1203 | export interface TransformOptions extends ReadableOptions, WritableOptions {}
|
1204 |
|
1205 |
|
1206 | export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
|
1207 | readable: boolean;
|
1208 | writable: boolean;
|
1209 | constructor(opts?: TransformOptions);
|
1210 | _transform(chunk: Buffer, encoding: string, callback: Function): void;
|
1211 | _transform(chunk: string, encoding: string, callback: Function): void;
|
1212 | _flush(callback: Function): void;
|
1213 | read(size?: number): any;
|
1214 | setEncoding(encoding: string): void;
|
1215 | pause(): void;
|
1216 | resume(): void;
|
1217 | pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
1218 | unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
1219 | unshift(chunk: string): void;
|
1220 | unshift(chunk: Buffer): void;
|
1221 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
1222 | push(chunk: any, encoding?: string): boolean;
|
1223 | write(buffer: Buffer, cb?: Function): boolean;
|
1224 | write(str: string, cb?: Function): boolean;
|
1225 | write(str: string, encoding?: string, cb?: Function): boolean;
|
1226 | end(): void;
|
1227 | end(buffer: Buffer, cb?: Function): void;
|
1228 | end(str: string, cb?: Function): void;
|
1229 | end(str: string, encoding?: string, cb?: Function): void;
|
1230 | }
|
1231 |
|
1232 | export class PassThrough extends Transform {}
|
1233 | }
|
1234 |
|
1235 | declare module "util" {
|
1236 | export interface InspectOptions {
|
1237 | showHidden?: boolean;
|
1238 | depth?: number;
|
1239 | colors?: boolean;
|
1240 | customInspect?: boolean;
|
1241 | }
|
1242 |
|
1243 | export function format(format: any, ...param: any[]): string;
|
1244 | export function debug(string: string): void;
|
1245 | export function error(...param: any[]): void;
|
1246 | export function puts(...param: any[]): void;
|
1247 | export function print(...param: any[]): void;
|
1248 | export function log(string: string): void;
|
1249 | export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string;
|
1250 | export function inspect(object: any, options: InspectOptions): string;
|
1251 | export function isArray(object: any): boolean;
|
1252 | export function isRegExp(object: any): boolean;
|
1253 | export function isDate(object: any): boolean;
|
1254 | export function isError(object: any): boolean;
|
1255 | export function inherits(constructor: any, superConstructor: any): void;
|
1256 | }
|
1257 |
|
1258 | declare module "assert" {
|
1259 | function internal (value: any, message?: string): void;
|
1260 | module internal {
|
1261 | export class AssertionError implements Error {
|
1262 | name: string;
|
1263 | message: string;
|
1264 | actual: any;
|
1265 | expected: any;
|
1266 | operator: string;
|
1267 | generatedMessage: boolean;
|
1268 |
|
1269 | constructor(options?: {message?: string; actual?: any; expected?: any;
|
1270 | operator?: string; stackStartFunction?: Function});
|
1271 | }
|
1272 |
|
1273 | export function fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
1274 | export function ok(value: any, message?: string): void;
|
1275 | export function equal(actual: any, expected: any, message?: string): void;
|
1276 | export function notEqual(actual: any, expected: any, message?: string): void;
|
1277 | export function deepEqual(actual: any, expected: any, message?: string): void;
|
1278 | export function notDeepEqual(acutal: any, expected: any, message?: string): void;
|
1279 | export function strictEqual(actual: any, expected: any, message?: string): void;
|
1280 | export function notStrictEqual(actual: any, expected: any, message?: string): void;
|
1281 | export var throws: {
|
1282 | (block: Function, message?: string): void;
|
1283 | (block: Function, error: Function, message?: string): void;
|
1284 | (block: Function, error: RegExp, message?: string): void;
|
1285 | (block: Function, error: (err: any) => boolean, message?: string): void;
|
1286 | };
|
1287 |
|
1288 | export var doesNotThrow: {
|
1289 | (block: Function, message?: string): void;
|
1290 | (block: Function, error: Function, message?: string): void;
|
1291 | (block: Function, error: RegExp, message?: string): void;
|
1292 | (block: Function, error: (err: any) => boolean, message?: string): void;
|
1293 | };
|
1294 |
|
1295 | export function ifError(value: any): void;
|
1296 | }
|
1297 |
|
1298 | export = internal;
|
1299 | }
|
1300 |
|
1301 | declare module "tty" {
|
1302 | import net = require("net");
|
1303 |
|
1304 | export function isatty(fd: number): boolean;
|
1305 | export interface ReadStream extends net.Socket {
|
1306 | isRaw: boolean;
|
1307 | setRawMode(mode: boolean): void;
|
1308 | }
|
1309 | export interface WriteStream extends net.Socket {
|
1310 | columns: number;
|
1311 | rows: number;
|
1312 | }
|
1313 | }
|
1314 |
|
1315 | declare module "domain" {
|
1316 | import events = require("events");
|
1317 |
|
1318 | export class Domain extends events.EventEmitter {
|
1319 | run(fn: Function): void;
|
1320 | add(emitter: events.EventEmitter): void;
|
1321 | remove(emitter: events.EventEmitter): void;
|
1322 | bind(cb: (err: Error, data: any) => any): any;
|
1323 | intercept(cb: (data: any) => any): any;
|
1324 | dispose(): void;
|
1325 |
|
1326 | addListener(event: string, listener: Function): Domain;
|
1327 | on(event: string, listener: Function): Domain;
|
1328 | once(event: string, listener: Function): Domain;
|
1329 | removeListener(event: string, listener: Function): Domain;
|
1330 | removeAllListeners(event?: string): Domain;
|
1331 | }
|
1332 |
|
1333 | export function create(): Domain;
|
1334 | }
|