1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | interface Error {
|
13 | stack?: string;
|
14 | }
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | interface MapConstructor {}
|
21 | interface WeakMapConstructor {}
|
22 | interface SetConstructor {}
|
23 | interface WeakSetConstructor {}
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | declare var process: NodeJS.Process;
|
31 | declare var global: NodeJS.Global;
|
32 |
|
33 | declare var __filename: string;
|
34 | declare var __dirname: string;
|
35 |
|
36 | declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
37 | declare function clearTimeout(timeoutId: NodeJS.Timer): void;
|
38 | declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
|
39 | declare function clearInterval(intervalId: NodeJS.Timer): void;
|
40 | declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
|
41 | declare function clearImmediate(immediateId: any): void;
|
42 |
|
43 | interface NodeRequireFunction {
|
44 | (id: string): any;
|
45 | }
|
46 |
|
47 | interface NodeRequire extends NodeRequireFunction {
|
48 | resolve(id:string): string;
|
49 | cache: any;
|
50 | extensions: any;
|
51 | main: any;
|
52 | }
|
53 |
|
54 | declare var require: NodeRequire;
|
55 |
|
56 | interface NodeModule {
|
57 | exports: any;
|
58 | require: NodeRequireFunction;
|
59 | id: string;
|
60 | filename: string;
|
61 | loaded: boolean;
|
62 | parent: any;
|
63 | children: any[];
|
64 | }
|
65 |
|
66 | declare var module: NodeModule;
|
67 |
|
68 | // Same as module.exports
|
69 | declare var exports: any;
|
70 | declare var SlowBuffer: {
|
71 | new (str: string, encoding?: string): Buffer;
|
72 | new (size: number): Buffer;
|
73 | new (size: Uint8Array): Buffer;
|
74 | new (array: any[]): Buffer;
|
75 | prototype: Buffer;
|
76 | isBuffer(obj: any): boolean;
|
77 | byteLength(string: string, encoding?: string): number;
|
78 | concat(list: Buffer[], totalLength?: number): Buffer;
|
79 | };
|
80 |
|
81 |
|
82 |
|
83 | interface Buffer extends NodeBuffer {}
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | declare var Buffer: {
|
91 | |
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | new (str: string, encoding?: string): Buffer;
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 | new (size: number): Buffer;
|
104 | |
105 |
|
106 |
|
107 |
|
108 |
|
109 | new (array: Uint8Array): Buffer;
|
110 | |
111 |
|
112 |
|
113 |
|
114 |
|
115 | new (array: any[]): Buffer;
|
116 | |
117 |
|
118 |
|
119 |
|
120 |
|
121 | new (buffer: Buffer): Buffer;
|
122 | prototype: Buffer;
|
123 | |
124 |
|
125 |
|
126 |
|
127 |
|
128 | isBuffer(obj: any): obj is Buffer;
|
129 | |
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | isEncoding(encoding: string): boolean;
|
136 | |
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 | byteLength(string: string, encoding?: string): number;
|
144 | |
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | concat(list: Buffer[], totalLength?: number): Buffer;
|
156 | |
157 |
|
158 |
|
159 | compare(buf1: Buffer, buf2: Buffer): number;
|
160 | };
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 | declare module NodeJS {
|
168 | export interface ErrnoException extends Error {
|
169 | errno?: number;
|
170 | code?: string;
|
171 | path?: string;
|
172 | syscall?: string;
|
173 | stack?: string;
|
174 | }
|
175 |
|
176 | export interface EventEmitter {
|
177 | addListener(event: string, listener: Function): EventEmitter;
|
178 | on(event: string, listener: Function): EventEmitter;
|
179 | once(event: string, listener: Function): EventEmitter;
|
180 | removeListener(event: string, listener: Function): EventEmitter;
|
181 | removeAllListeners(event?: string): EventEmitter;
|
182 | setMaxListeners(n: number): EventEmitter;
|
183 | getMaxListeners(): number;
|
184 | listeners(event: string): Function[];
|
185 | emit(event: string, ...args: any[]): boolean;
|
186 | listenerCount(type: string): number;
|
187 | }
|
188 |
|
189 | export interface ReadableStream extends EventEmitter {
|
190 | readable: boolean;
|
191 | read(size?: number): string|Buffer;
|
192 | setEncoding(encoding: string): void;
|
193 | pause(): void;
|
194 | resume(): void;
|
195 | pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
196 | unpipe<T extends WritableStream>(destination?: T): void;
|
197 | unshift(chunk: string): void;
|
198 | unshift(chunk: Buffer): void;
|
199 | wrap(oldStream: ReadableStream): ReadableStream;
|
200 | }
|
201 |
|
202 | export interface WritableStream extends EventEmitter {
|
203 | writable: boolean;
|
204 | write(buffer: Buffer|string, cb?: Function): boolean;
|
205 | write(str: string, encoding?: string, cb?: Function): boolean;
|
206 | end(): void;
|
207 | end(buffer: Buffer, cb?: Function): void;
|
208 | end(str: string, cb?: Function): void;
|
209 | end(str: string, encoding?: string, cb?: Function): void;
|
210 | }
|
211 |
|
212 | export interface ReadWriteStream extends ReadableStream, WritableStream {}
|
213 |
|
214 | export interface Process extends EventEmitter {
|
215 | stdout: WritableStream;
|
216 | stderr: WritableStream;
|
217 | stdin: ReadableStream;
|
218 | argv: string[];
|
219 | execArgv: string[];
|
220 | execPath: string;
|
221 | abort(): void;
|
222 | chdir(directory: string): void;
|
223 | cwd(): string;
|
224 | env: any;
|
225 | exit(code?: number): void;
|
226 | getgid(): number;
|
227 | setgid(id: number): void;
|
228 | setgid(id: string): void;
|
229 | getuid(): number;
|
230 | setuid(id: number): void;
|
231 | setuid(id: string): void;
|
232 | version: string;
|
233 | versions: {
|
234 | http_parser: string;
|
235 | node: string;
|
236 | v8: string;
|
237 | ares: string;
|
238 | uv: string;
|
239 | zlib: string;
|
240 | openssl: string;
|
241 | };
|
242 | config: {
|
243 | target_defaults: {
|
244 | cflags: any[];
|
245 | default_configuration: string;
|
246 | defines: string[];
|
247 | include_dirs: string[];
|
248 | libraries: string[];
|
249 | };
|
250 | variables: {
|
251 | clang: number;
|
252 | host_arch: string;
|
253 | node_install_npm: boolean;
|
254 | node_install_waf: boolean;
|
255 | node_prefix: string;
|
256 | node_shared_openssl: boolean;
|
257 | node_shared_v8: boolean;
|
258 | node_shared_zlib: boolean;
|
259 | node_use_dtrace: boolean;
|
260 | node_use_etw: boolean;
|
261 | node_use_openssl: boolean;
|
262 | target_arch: string;
|
263 | v8_no_strict_aliasing: number;
|
264 | v8_use_snapshot: boolean;
|
265 | visibility: string;
|
266 | };
|
267 | };
|
268 | kill(pid:number, signal?: string|number): void;
|
269 | pid: number;
|
270 | title: string;
|
271 | arch: string;
|
272 | platform: string;
|
273 | memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; };
|
274 | nextTick(callback: Function): void;
|
275 | umask(mask?: number): number;
|
276 | uptime(): number;
|
277 | hrtime(time?:number[]): number[];
|
278 |
|
279 |
|
280 | send?(message: any, sendHandle?: any): void;
|
281 | }
|
282 |
|
283 | export interface Global {
|
284 | Array: typeof Array;
|
285 | ArrayBuffer: typeof ArrayBuffer;
|
286 | Boolean: typeof Boolean;
|
287 | Buffer: typeof Buffer;
|
288 | DataView: typeof DataView;
|
289 | Date: typeof Date;
|
290 | Error: typeof Error;
|
291 | EvalError: typeof EvalError;
|
292 | Float32Array: typeof Float32Array;
|
293 | Float64Array: typeof Float64Array;
|
294 | Function: typeof Function;
|
295 | GLOBAL: Global;
|
296 | Infinity: typeof Infinity;
|
297 | Int16Array: typeof Int16Array;
|
298 | Int32Array: typeof Int32Array;
|
299 | Int8Array: typeof Int8Array;
|
300 | Intl: typeof Intl;
|
301 | JSON: typeof JSON;
|
302 | Map: MapConstructor;
|
303 | Math: typeof Math;
|
304 | NaN: typeof NaN;
|
305 | Number: typeof Number;
|
306 | Object: typeof Object;
|
307 | Promise: Function;
|
308 | RangeError: typeof RangeError;
|
309 | ReferenceError: typeof ReferenceError;
|
310 | RegExp: typeof RegExp;
|
311 | Set: SetConstructor;
|
312 | String: typeof String;
|
313 | Symbol: Function;
|
314 | SyntaxError: typeof SyntaxError;
|
315 | TypeError: typeof TypeError;
|
316 | URIError: typeof URIError;
|
317 | Uint16Array: typeof Uint16Array;
|
318 | Uint32Array: typeof Uint32Array;
|
319 | Uint8Array: typeof Uint8Array;
|
320 | Uint8ClampedArray: Function;
|
321 | WeakMap: WeakMapConstructor;
|
322 | WeakSet: WeakSetConstructor;
|
323 | clearImmediate: (immediateId: any) => void;
|
324 | clearInterval: (intervalId: NodeJS.Timer) => void;
|
325 | clearTimeout: (timeoutId: NodeJS.Timer) => void;
|
326 | console: typeof console;
|
327 | decodeURI: typeof decodeURI;
|
328 | decodeURIComponent: typeof decodeURIComponent;
|
329 | encodeURI: typeof encodeURI;
|
330 | encodeURIComponent: typeof encodeURIComponent;
|
331 | escape: (str: string) => string;
|
332 | eval: typeof eval;
|
333 | global: Global;
|
334 | isFinite: typeof isFinite;
|
335 | isNaN: typeof isNaN;
|
336 | parseFloat: typeof parseFloat;
|
337 | parseInt: typeof parseInt;
|
338 | process: Process;
|
339 | root: Global;
|
340 | setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any;
|
341 | setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;
|
342 | setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;
|
343 | undefined: typeof undefined;
|
344 | unescape: (str: string) => string;
|
345 | gc: () => void;
|
346 | v8debug?: any;
|
347 | }
|
348 |
|
349 | export interface Timer {
|
350 | ref() : void;
|
351 | unref() : void;
|
352 | }
|
353 | }
|
354 |
|
355 |
|
356 |
|
357 |
|
358 | interface NodeBuffer {
|
359 | [index: number]: number;
|
360 | write(string: string, offset?: number, length?: number, encoding?: string): number;
|
361 | toString(encoding?: string, start?: number, end?: number): string;
|
362 | toJSON(): any;
|
363 | length: number;
|
364 | equals(otherBuffer: Buffer): boolean;
|
365 | compare(otherBuffer: Buffer): number;
|
366 | copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
367 | slice(start?: number, end?: number): Buffer;
|
368 | writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
369 | writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
370 | writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
371 | writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
372 | readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
373 | readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
374 | readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
375 | readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
376 | readUInt8(offset: number, noAsset?: boolean): number;
|
377 | readUInt16LE(offset: number, noAssert?: boolean): number;
|
378 | readUInt16BE(offset: number, noAssert?: boolean): number;
|
379 | readUInt32LE(offset: number, noAssert?: boolean): number;
|
380 | readUInt32BE(offset: number, noAssert?: boolean): number;
|
381 | readInt8(offset: number, noAssert?: boolean): number;
|
382 | readInt16LE(offset: number, noAssert?: boolean): number;
|
383 | readInt16BE(offset: number, noAssert?: boolean): number;
|
384 | readInt32LE(offset: number, noAssert?: boolean): number;
|
385 | readInt32BE(offset: number, noAssert?: boolean): number;
|
386 | readFloatLE(offset: number, noAssert?: boolean): number;
|
387 | readFloatBE(offset: number, noAssert?: boolean): number;
|
388 | readDoubleLE(offset: number, noAssert?: boolean): number;
|
389 | readDoubleBE(offset: number, noAssert?: boolean): number;
|
390 | writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
391 | writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
392 | writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
393 | writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
394 | writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
395 | writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
396 | writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
397 | writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
398 | writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
399 | writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
400 | writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
401 | writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
402 | writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
403 | writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
404 | fill(value: any, offset?: number, end?: number): Buffer;
|
405 | indexOf(value: string | number | Buffer, byteOffset?: number): number;
|
406 | }
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 | declare module "buffer" {
|
414 | export var INSPECT_MAX_BYTES: number;
|
415 | var BuffType: typeof Buffer;
|
416 | var SlowBuffType: typeof SlowBuffer;
|
417 | export { BuffType as Buffer, SlowBuffType as SlowBuffer };
|
418 | }
|
419 |
|
420 | declare module "querystring" {
|
421 | export interface StringifyOptions {
|
422 | encodeURIComponent?: Function;
|
423 | }
|
424 |
|
425 | export interface ParseOptions {
|
426 | maxKeys?: number;
|
427 | decodeURIComponent?: Function;
|
428 | }
|
429 |
|
430 | export function stringify<T>(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string;
|
431 | export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any;
|
432 | export function parse<T extends {}>(str: string, sep?: string, eq?: string, options?: ParseOptions): T;
|
433 | export function escape(str: string): string;
|
434 | export function unescape(str: string): string;
|
435 | }
|
436 |
|
437 | declare module "events" {
|
438 | export class EventEmitter implements NodeJS.EventEmitter {
|
439 | static EventEmitter: EventEmitter;
|
440 | static listenerCount(emitter: EventEmitter, event: string): number;
|
441 | static defaultMaxListeners: number;
|
442 |
|
443 | addListener(event: string, listener: Function): EventEmitter;
|
444 | on(event: string, listener: Function): EventEmitter;
|
445 | once(event: string, listener: Function): EventEmitter;
|
446 | removeListener(event: string, listener: Function): EventEmitter;
|
447 | removeAllListeners(event?: string): EventEmitter;
|
448 | setMaxListeners(n: number): EventEmitter;
|
449 | getMaxListeners(): number;
|
450 | listeners(event: string): Function[];
|
451 | emit(event: string, ...args: any[]): boolean;
|
452 | listenerCount(type: string): number;
|
453 | }
|
454 | }
|
455 |
|
456 | declare module "http" {
|
457 | import * as events from "events";
|
458 | import * as net from "net";
|
459 | import * as stream from "stream";
|
460 |
|
461 | export interface RequestOptions {
|
462 | protocol?: string;
|
463 | host?: string;
|
464 | hostname?: string;
|
465 | family?: number;
|
466 | port?: number;
|
467 | localAddress?: string;
|
468 | socketPath?: string;
|
469 | method?: string;
|
470 | path?: string;
|
471 | headers?: { [key: string]: any };
|
472 | auth?: string;
|
473 | agent?: Agent|boolean;
|
474 | }
|
475 |
|
476 | export interface Server extends events.EventEmitter {
|
477 | listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
|
478 | listen(port: number, hostname?: string, callback?: Function): Server;
|
479 | listen(path: string, callback?: Function): Server;
|
480 | listen(handle: any, listeningListener?: Function): Server;
|
481 | close(cb?: any): Server;
|
482 | address(): { port: number; family: string; address: string; };
|
483 | maxHeadersCount: number;
|
484 | }
|
485 | |
486 |
|
487 |
|
488 | export interface ServerRequest extends IncomingMessage {
|
489 | connection: net.Socket;
|
490 | }
|
491 | export interface ServerResponse extends events.EventEmitter, stream.Writable {
|
492 |
|
493 | write(buffer: Buffer): boolean;
|
494 | write(buffer: Buffer, cb?: Function): boolean;
|
495 | write(str: string, cb?: Function): boolean;
|
496 | write(str: string, encoding?: string, cb?: Function): boolean;
|
497 | write(str: string, encoding?: string, fd?: string): boolean;
|
498 |
|
499 | writeContinue(): void;
|
500 | writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void;
|
501 | writeHead(statusCode: number, headers?: any): void;
|
502 | statusCode: number;
|
503 | statusMessage: string;
|
504 | headersSent: boolean;
|
505 | setHeader(name: string, value: string | string[]): void;
|
506 | sendDate: boolean;
|
507 | getHeader(name: string): string;
|
508 | removeHeader(name: string): void;
|
509 | write(chunk: any, encoding?: string): any;
|
510 | addTrailers(headers: any): void;
|
511 |
|
512 |
|
513 | end(): void;
|
514 | end(buffer: Buffer, cb?: Function): void;
|
515 | end(str: string, cb?: Function): void;
|
516 | end(str: string, encoding?: string, cb?: Function): void;
|
517 | end(data?: any, encoding?: string): void;
|
518 | }
|
519 | export interface ClientRequest extends events.EventEmitter, stream.Writable {
|
520 |
|
521 | write(buffer: Buffer): boolean;
|
522 | write(buffer: Buffer, cb?: Function): boolean;
|
523 | write(str: string, cb?: Function): boolean;
|
524 | write(str: string, encoding?: string, cb?: Function): boolean;
|
525 | write(str: string, encoding?: string, fd?: string): boolean;
|
526 |
|
527 | write(chunk: any, encoding?: string): void;
|
528 | abort(): void;
|
529 | setTimeout(timeout: number, callback?: Function): void;
|
530 | setNoDelay(noDelay?: boolean): void;
|
531 | setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
|
532 |
|
533 |
|
534 | end(): void;
|
535 | end(buffer: Buffer, cb?: Function): void;
|
536 | end(str: string, cb?: Function): void;
|
537 | end(str: string, encoding?: string, cb?: Function): void;
|
538 | end(data?: any, encoding?: string): void;
|
539 | }
|
540 | export interface IncomingMessage extends events.EventEmitter, stream.Readable {
|
541 | httpVersion: string;
|
542 | headers: any;
|
543 | rawHeaders: string[];
|
544 | trailers: any;
|
545 | rawTrailers: any;
|
546 | setTimeout(msecs: number, callback: Function): NodeJS.Timer;
|
547 | |
548 |
|
549 |
|
550 | method?: string;
|
551 | |
552 |
|
553 |
|
554 | url?: string;
|
555 | |
556 |
|
557 |
|
558 | statusCode?: number;
|
559 | |
560 |
|
561 |
|
562 | statusMessage?: string;
|
563 | socket: net.Socket;
|
564 | }
|
565 | |
566 |
|
567 |
|
568 | export interface ClientResponse extends IncomingMessage { }
|
569 |
|
570 | export interface AgentOptions {
|
571 | |
572 |
|
573 |
|
574 | keepAlive?: boolean;
|
575 | |
576 |
|
577 |
|
578 |
|
579 | keepAliveMsecs?: number;
|
580 | |
581 |
|
582 |
|
583 | maxSockets?: number;
|
584 | |
585 |
|
586 |
|
587 | maxFreeSockets?: number;
|
588 | }
|
589 |
|
590 | export class Agent {
|
591 | maxSockets: number;
|
592 | sockets: any;
|
593 | requests: any;
|
594 |
|
595 | constructor(opts?: AgentOptions);
|
596 |
|
597 | /**
|
598 | * Destroy any sockets that are currently in use by the agent.
|
599 | * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled,
|
600 | * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise,
|
601 | * sockets may hang open for quite a long time before the server terminates them.
|
602 | */
|
603 | destroy(): void;
|
604 | }
|
605 |
|
606 | export var METHODS: string[];
|
607 |
|
608 | export var STATUS_CODES: {
|
609 | [errorCode: number]: string;
|
610 | [errorCode: string]: string;
|
611 | };
|
612 | export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
|
613 | export function createClient(port?: number, host?: string): any;
|
614 | export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
615 | export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
616 | export var globalAgent: Agent;
|
617 | }
|
618 |
|
619 | declare module "cluster" {
|
620 | import * as child from "child_process";
|
621 | import * as events from "events";
|
622 |
|
623 | export interface ClusterSettings {
|
624 | exec?: string;
|
625 | args?: string[];
|
626 | silent?: boolean;
|
627 | }
|
628 |
|
629 | export class Worker extends events.EventEmitter {
|
630 | id: string;
|
631 | process: child.ChildProcess;
|
632 | suicide: boolean;
|
633 | send(message: any, sendHandle?: any): void;
|
634 | kill(signal?: string): void;
|
635 | destroy(signal?: string): void;
|
636 | disconnect(): void;
|
637 | }
|
638 |
|
639 | export var settings: ClusterSettings;
|
640 | export var isMaster: boolean;
|
641 | export var isWorker: boolean;
|
642 | export function setupMaster(settings?: ClusterSettings): void;
|
643 | export function fork(env?: any): Worker;
|
644 | export function disconnect(callback?: Function): void;
|
645 | export var worker: Worker;
|
646 | export var workers: Worker[];
|
647 |
|
648 |
|
649 | export function addListener(event: string, listener: Function): void;
|
650 | export function on(event: "disconnect", listener: (worker: Worker) => void): void;
|
651 | export function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): void;
|
652 | export function on(event: "fork", listener: (worker: Worker) => void): void;
|
653 | export function on(event: "listening", listener: (worker: Worker, address: any) => void): void;
|
654 | export function on(event: "message", listener: (worker: Worker, message: any) => void): void;
|
655 | export function on(event: "online", listener: (worker: Worker) => void): void;
|
656 | export function on(event: "setup", listener: (settings: any) => void): void;
|
657 | export function on(event: string, listener: Function): any;
|
658 | export function once(event: string, listener: Function): void;
|
659 | export function removeListener(event: string, listener: Function): void;
|
660 | export function removeAllListeners(event?: string): void;
|
661 | export function setMaxListeners(n: number): void;
|
662 | export function listeners(event: string): Function[];
|
663 | export function emit(event: string, ...args: any[]): boolean;
|
664 | }
|
665 |
|
666 | declare module "zlib" {
|
667 | import * as stream from "stream";
|
668 | export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; }
|
669 |
|
670 | export interface Gzip extends stream.Transform { }
|
671 | export interface Gunzip extends stream.Transform { }
|
672 | export interface Deflate extends stream.Transform { }
|
673 | export interface Inflate extends stream.Transform { }
|
674 | export interface DeflateRaw extends stream.Transform { }
|
675 | export interface InflateRaw extends stream.Transform { }
|
676 | export interface Unzip extends stream.Transform { }
|
677 |
|
678 | export function createGzip(options?: ZlibOptions): Gzip;
|
679 | export function createGunzip(options?: ZlibOptions): Gunzip;
|
680 | export function createDeflate(options?: ZlibOptions): Deflate;
|
681 | export function createInflate(options?: ZlibOptions): Inflate;
|
682 | export function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
|
683 | export function createInflateRaw(options?: ZlibOptions): InflateRaw;
|
684 | export function createUnzip(options?: ZlibOptions): Unzip;
|
685 |
|
686 | export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
687 | export function deflateSync(buf: Buffer, options?: ZlibOptions): any;
|
688 | export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
689 | export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
690 | export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
691 | export function gzipSync(buf: Buffer, options?: ZlibOptions): any;
|
692 | export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
693 | export function gunzipSync(buf: Buffer, options?: ZlibOptions): any;
|
694 | export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
695 | export function inflateSync(buf: Buffer, options?: ZlibOptions): any;
|
696 | export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
697 | export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
698 | export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
699 | export function unzipSync(buf: Buffer, options?: ZlibOptions): any;
|
700 |
|
701 |
|
702 | export var Z_NO_FLUSH: number;
|
703 | export var Z_PARTIAL_FLUSH: number;
|
704 | export var Z_SYNC_FLUSH: number;
|
705 | export var Z_FULL_FLUSH: number;
|
706 | export var Z_FINISH: number;
|
707 | export var Z_BLOCK: number;
|
708 | export var Z_TREES: number;
|
709 | export var Z_OK: number;
|
710 | export var Z_STREAM_END: number;
|
711 | export var Z_NEED_DICT: number;
|
712 | export var Z_ERRNO: number;
|
713 | export var Z_STREAM_ERROR: number;
|
714 | export var Z_DATA_ERROR: number;
|
715 | export var Z_MEM_ERROR: number;
|
716 | export var Z_BUF_ERROR: number;
|
717 | export var Z_VERSION_ERROR: number;
|
718 | export var Z_NO_COMPRESSION: number;
|
719 | export var Z_BEST_SPEED: number;
|
720 | export var Z_BEST_COMPRESSION: number;
|
721 | export var Z_DEFAULT_COMPRESSION: number;
|
722 | export var Z_FILTERED: number;
|
723 | export var Z_HUFFMAN_ONLY: number;
|
724 | export var Z_RLE: number;
|
725 | export var Z_FIXED: number;
|
726 | export var Z_DEFAULT_STRATEGY: number;
|
727 | export var Z_BINARY: number;
|
728 | export var Z_TEXT: number;
|
729 | export var Z_ASCII: number;
|
730 | export var Z_UNKNOWN: number;
|
731 | export var Z_DEFLATED: number;
|
732 | export var Z_NULL: number;
|
733 | }
|
734 |
|
735 | declare module "os" {
|
736 | export interface CpuInfo {
|
737 | model: string;
|
738 | speed: number;
|
739 | times: {
|
740 | user: number;
|
741 | nice: number;
|
742 | sys: number;
|
743 | idle: number;
|
744 | irq: number;
|
745 | };
|
746 | }
|
747 |
|
748 | export interface NetworkInterfaceInfo {
|
749 | address: string;
|
750 | netmask: string;
|
751 | family: string;
|
752 | mac: string;
|
753 | internal: boolean;
|
754 | }
|
755 |
|
756 | export function tmpdir(): string;
|
757 | export function homedir(): string;
|
758 | export function endianness(): string;
|
759 | export function hostname(): string;
|
760 | export function type(): string;
|
761 | export function platform(): string;
|
762 | export function arch(): string;
|
763 | export function release(): string;
|
764 | export function uptime(): number;
|
765 | export function loadavg(): number[];
|
766 | export function totalmem(): number;
|
767 | export function freemem(): number;
|
768 | export function cpus(): CpuInfo[];
|
769 | export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]};
|
770 | export var EOL: string;
|
771 | }
|
772 |
|
773 | declare module "https" {
|
774 | import * as tls from "tls";
|
775 | import * as events from "events";
|
776 | import * as http from "http";
|
777 |
|
778 | export interface ServerOptions {
|
779 | pfx?: any;
|
780 | key?: any;
|
781 | passphrase?: string;
|
782 | cert?: any;
|
783 | ca?: any;
|
784 | crl?: any;
|
785 | ciphers?: string;
|
786 | honorCipherOrder?: boolean;
|
787 | requestCert?: boolean;
|
788 | rejectUnauthorized?: boolean;
|
789 | NPNProtocols?: any;
|
790 | SNICallback?: (servername: string) => any;
|
791 | }
|
792 |
|
793 | export interface RequestOptions extends http.RequestOptions{
|
794 | pfx?: any;
|
795 | key?: any;
|
796 | passphrase?: string;
|
797 | cert?: any;
|
798 | ca?: any;
|
799 | ciphers?: string;
|
800 | rejectUnauthorized?: boolean;
|
801 | secureProtocol?: string;
|
802 | }
|
803 |
|
804 | export interface Agent {
|
805 | maxSockets: number;
|
806 | sockets: any;
|
807 | requests: any;
|
808 | }
|
809 | export var Agent: {
|
810 | new (options?: RequestOptions): Agent;
|
811 | };
|
812 | export interface Server extends tls.Server { }
|
813 | export function createServer(options: ServerOptions, requestListener?: Function): Server;
|
814 | export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
815 | export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
816 | export var globalAgent: Agent;
|
817 | }
|
818 |
|
819 | declare module "punycode" {
|
820 | export function decode(string: string): string;
|
821 | export function encode(string: string): string;
|
822 | export function toUnicode(domain: string): string;
|
823 | export function toASCII(domain: string): string;
|
824 | export var ucs2: ucs2;
|
825 | interface ucs2 {
|
826 | decode(string: string): number[];
|
827 | encode(codePoints: number[]): string;
|
828 | }
|
829 | export var version: any;
|
830 | }
|
831 |
|
832 | declare module "repl" {
|
833 | import * as stream from "stream";
|
834 | import * as events from "events";
|
835 |
|
836 | export interface ReplOptions {
|
837 | prompt?: string;
|
838 | input?: NodeJS.ReadableStream;
|
839 | output?: NodeJS.WritableStream;
|
840 | terminal?: boolean;
|
841 | eval?: Function;
|
842 | useColors?: boolean;
|
843 | useGlobal?: boolean;
|
844 | ignoreUndefined?: boolean;
|
845 | writer?: Function;
|
846 | }
|
847 | export function start(options: ReplOptions): events.EventEmitter;
|
848 | }
|
849 |
|
850 | declare module "readline" {
|
851 | import * as events from "events";
|
852 | import * as stream from "stream";
|
853 |
|
854 | export interface Key {
|
855 | sequence?: string;
|
856 | name?: string;
|
857 | ctrl?: boolean;
|
858 | meta?: boolean;
|
859 | shift?: boolean;
|
860 | }
|
861 |
|
862 | export interface ReadLine extends events.EventEmitter {
|
863 | setPrompt(prompt: string): void;
|
864 | prompt(preserveCursor?: boolean): void;
|
865 | question(query: string, callback: (answer: string) => void): void;
|
866 | pause(): ReadLine;
|
867 | resume(): ReadLine;
|
868 | close(): void;
|
869 | write(data: string|Buffer, key?: Key): void;
|
870 | }
|
871 |
|
872 | export interface Completer {
|
873 | (line: string): CompleterResult;
|
874 | (line: string, callback: (err: any, result: CompleterResult) => void): any;
|
875 | }
|
876 |
|
877 | export interface CompleterResult {
|
878 | completions: string[];
|
879 | line: string;
|
880 | }
|
881 |
|
882 | export interface ReadLineOptions {
|
883 | input: NodeJS.ReadableStream;
|
884 | output?: NodeJS.WritableStream;
|
885 | completer?: Completer;
|
886 | terminal?: boolean;
|
887 | historySize?: number;
|
888 | }
|
889 |
|
890 | export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine;
|
891 | export function createInterface(options: ReadLineOptions): ReadLine;
|
892 |
|
893 | export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void;
|
894 | export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void;
|
895 | export function clearLine(stream: NodeJS.WritableStream, dir: number): void;
|
896 | export function clearScreenDown(stream: NodeJS.WritableStream): void;
|
897 | }
|
898 |
|
899 | declare module "vm" {
|
900 | export interface Context { }
|
901 | export interface Script {
|
902 | runInThisContext(): void;
|
903 | runInNewContext(sandbox?: Context): void;
|
904 | }
|
905 | export function runInThisContext(code: string, filename?: string): void;
|
906 | export function runInNewContext(code: string, sandbox?: Context, filename?: string): void;
|
907 | export function runInContext(code: string, context: Context, filename?: string): void;
|
908 | export function createContext(initSandbox?: Context): Context;
|
909 | export function createScript(code: string, filename?: string): Script;
|
910 | }
|
911 |
|
912 | declare module "child_process" {
|
913 | import * as events from "events";
|
914 | import * as stream from "stream";
|
915 |
|
916 | export interface ChildProcess extends events.EventEmitter {
|
917 | stdin: stream.Writable;
|
918 | stdout: stream.Readable;
|
919 | stderr: stream.Readable;
|
920 | stdio: (stream.Readable|stream.Writable)[];
|
921 | pid: number;
|
922 | kill(signal?: string): void;
|
923 | send(message: any, sendHandle?: any): void;
|
924 | disconnect(): void;
|
925 | unref(): void;
|
926 | }
|
927 |
|
928 | export function spawn(command: string, args?: string[], options?: {
|
929 | cwd?: string;
|
930 | stdio?: any;
|
931 | custom?: any;
|
932 | env?: any;
|
933 | detached?: boolean;
|
934 | }): ChildProcess;
|
935 | export function exec(command: string, options: {
|
936 | cwd?: string;
|
937 | stdio?: any;
|
938 | customFds?: any;
|
939 | env?: any;
|
940 | encoding?: string;
|
941 | timeout?: number;
|
942 | maxBuffer?: number;
|
943 | killSignal?: string;
|
944 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
945 | export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
946 | export function execFile(file: string,
|
947 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
948 | export function execFile(file: string, args?: string[],
|
949 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
950 | export function execFile(file: string, args?: string[], options?: {
|
951 | cwd?: string;
|
952 | stdio?: any;
|
953 | customFds?: any;
|
954 | env?: any;
|
955 | encoding?: string;
|
956 | timeout?: number;
|
957 | maxBuffer?: number;
|
958 | killSignal?: string;
|
959 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
960 | export function fork(modulePath: string, args?: string[], options?: {
|
961 | cwd?: string;
|
962 | env?: any;
|
963 | execPath?: string;
|
964 | execArgv?: string[];
|
965 | silent?: boolean;
|
966 | uid?: number;
|
967 | gid?: number;
|
968 | }): ChildProcess;
|
969 | export function spawnSync(command: string, args?: string[], options?: {
|
970 | cwd?: string;
|
971 | input?: string | Buffer;
|
972 | stdio?: any;
|
973 | env?: any;
|
974 | uid?: number;
|
975 | gid?: number;
|
976 | timeout?: number;
|
977 | maxBuffer?: number;
|
978 | killSignal?: string;
|
979 | encoding?: string;
|
980 | }): {
|
981 | pid: number;
|
982 | output: string[];
|
983 | stdout: string | Buffer;
|
984 | stderr: string | Buffer;
|
985 | status: number;
|
986 | signal: string;
|
987 | error: Error;
|
988 | };
|
989 | export function execSync(command: string, options?: {
|
990 | cwd?: string;
|
991 | input?: string|Buffer;
|
992 | stdio?: any;
|
993 | env?: any;
|
994 | uid?: number;
|
995 | gid?: number;
|
996 | timeout?: number;
|
997 | maxBuffer?: number;
|
998 | killSignal?: string;
|
999 | encoding?: string;
|
1000 | }): string | Buffer;
|
1001 | export function execFileSync(command: string, args?: string[], options?: {
|
1002 | cwd?: string;
|
1003 | input?: string|Buffer;
|
1004 | stdio?: any;
|
1005 | env?: any;
|
1006 | uid?: number;
|
1007 | gid?: number;
|
1008 | timeout?: number;
|
1009 | maxBuffer?: number;
|
1010 | killSignal?: string;
|
1011 | encoding?: string;
|
1012 | }): string | Buffer;
|
1013 | }
|
1014 |
|
1015 | declare module "url" {
|
1016 | export interface Url {
|
1017 | href?: string;
|
1018 | protocol?: string;
|
1019 | auth?: string;
|
1020 | hostname?: string;
|
1021 | port?: string;
|
1022 | host?: string;
|
1023 | pathname?: string;
|
1024 | search?: string;
|
1025 | query?: any;
|
1026 | slashes?: boolean;
|
1027 | hash?: string;
|
1028 | path?: string;
|
1029 | }
|
1030 |
|
1031 | export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
1032 | export function format(url: Url): string;
|
1033 | export function resolve(from: string, to: string): string;
|
1034 | }
|
1035 |
|
1036 | declare module "dns" {
|
1037 | export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string;
|
1038 | export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string;
|
1039 | export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1040 | export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1041 | export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1042 | export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1043 | export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1044 | export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1045 | export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1046 | export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1047 | export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
1048 | export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[];
|
1049 | }
|
1050 |
|
1051 | declare module "net" {
|
1052 | import * as stream from "stream";
|
1053 |
|
1054 | export interface Socket extends stream.Duplex {
|
1055 |
|
1056 | write(buffer: Buffer): boolean;
|
1057 | write(buffer: Buffer, cb?: Function): boolean;
|
1058 | write(str: string, cb?: Function): boolean;
|
1059 | write(str: string, encoding?: string, cb?: Function): boolean;
|
1060 | write(str: string, encoding?: string, fd?: string): boolean;
|
1061 |
|
1062 | connect(port: number, host?: string, connectionListener?: Function): void;
|
1063 | connect(path: string, connectionListener?: Function): void;
|
1064 | bufferSize: number;
|
1065 | setEncoding(encoding?: string): void;
|
1066 | write(data: any, encoding?: string, callback?: Function): void;
|
1067 | destroy(): void;
|
1068 | pause(): void;
|
1069 | resume(): void;
|
1070 | setTimeout(timeout: number, callback?: Function): void;
|
1071 | setNoDelay(noDelay?: boolean): void;
|
1072 | setKeepAlive(enable?: boolean, initialDelay?: number): void;
|
1073 | address(): { port: number; family: string; address: string; };
|
1074 | unref(): void;
|
1075 | ref(): void;
|
1076 |
|
1077 | remoteAddress: string;
|
1078 | remoteFamily: string;
|
1079 | remotePort: number;
|
1080 | localAddress: string;
|
1081 | localPort: number;
|
1082 | bytesRead: number;
|
1083 | bytesWritten: number;
|
1084 |
|
1085 |
|
1086 | end(): void;
|
1087 | end(buffer: Buffer, cb?: Function): void;
|
1088 | end(str: string, cb?: Function): void;
|
1089 | end(str: string, encoding?: string, cb?: Function): void;
|
1090 | end(data?: any, encoding?: string): void;
|
1091 | }
|
1092 |
|
1093 | export var Socket: {
|
1094 | new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket;
|
1095 | };
|
1096 |
|
1097 | export interface Server extends Socket {
|
1098 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server;
|
1099 | listen(path: string, listeningListener?: Function): Server;
|
1100 | listen(handle: any, listeningListener?: Function): Server;
|
1101 | close(callback?: Function): Server;
|
1102 | address(): { port: number; family: string; address: string; };
|
1103 | maxConnections: number;
|
1104 | connections: number;
|
1105 | }
|
1106 | export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
|
1107 | export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
|
1108 | export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
1109 | export function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
1110 | export function connect(path: string, connectionListener?: Function): Socket;
|
1111 | export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
1112 | export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
1113 | export function createConnection(path: string, connectionListener?: Function): Socket;
|
1114 | export function isIP(input: string): number;
|
1115 | export function isIPv4(input: string): boolean;
|
1116 | export function isIPv6(input: string): boolean;
|
1117 | }
|
1118 |
|
1119 | declare module "dgram" {
|
1120 | import * as events from "events";
|
1121 |
|
1122 | interface RemoteInfo {
|
1123 | address: string;
|
1124 | port: number;
|
1125 | size: number;
|
1126 | }
|
1127 |
|
1128 | interface AddressInfo {
|
1129 | address: string;
|
1130 | family: string;
|
1131 | port: number;
|
1132 | }
|
1133 |
|
1134 | export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
1135 |
|
1136 | interface Socket extends events.EventEmitter {
|
1137 | send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
|
1138 | bind(port: number, address?: string, callback?: () => void): void;
|
1139 | close(): void;
|
1140 | address(): AddressInfo;
|
1141 | setBroadcast(flag: boolean): void;
|
1142 | setMulticastTTL(ttl: number): void;
|
1143 | setMulticastLoopback(flag: boolean): void;
|
1144 | addMembership(multicastAddress: string, multicastInterface?: string): void;
|
1145 | dropMembership(multicastAddress: string, multicastInterface?: string): void;
|
1146 | }
|
1147 | }
|
1148 |
|
1149 | declare module "fs" {
|
1150 | import * as stream from "stream";
|
1151 | import * as events from "events";
|
1152 |
|
1153 | interface Stats {
|
1154 | isFile(): boolean;
|
1155 | isDirectory(): boolean;
|
1156 | isBlockDevice(): boolean;
|
1157 | isCharacterDevice(): boolean;
|
1158 | isSymbolicLink(): boolean;
|
1159 | isFIFO(): boolean;
|
1160 | isSocket(): boolean;
|
1161 | dev: number;
|
1162 | ino: number;
|
1163 | mode: number;
|
1164 | nlink: number;
|
1165 | uid: number;
|
1166 | gid: number;
|
1167 | rdev: number;
|
1168 | size: number;
|
1169 | blksize: number;
|
1170 | blocks: number;
|
1171 | atime: Date;
|
1172 | mtime: Date;
|
1173 | ctime: Date;
|
1174 | birthtime: Date;
|
1175 | }
|
1176 |
|
1177 | interface FSWatcher extends events.EventEmitter {
|
1178 | close(): void;
|
1179 | }
|
1180 |
|
1181 | export interface ReadStream extends stream.Readable {
|
1182 | close(): void;
|
1183 | }
|
1184 | export interface WriteStream extends stream.Writable {
|
1185 | close(): void;
|
1186 | bytesWritten: number;
|
1187 | }
|
1188 |
|
1189 | |
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 | export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1196 | |
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 | export function renameSync(oldPath: string, newPath: string): void;
|
1202 | export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1203 | export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1204 | export function truncateSync(path: string, len?: number): void;
|
1205 | export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1206 | export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1207 | export function ftruncateSync(fd: number, len?: number): void;
|
1208 | export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1209 | export function chownSync(path: string, uid: number, gid: number): void;
|
1210 | export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1211 | export function fchownSync(fd: number, uid: number, gid: number): void;
|
1212 | export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1213 | export function lchownSync(path: string, uid: number, gid: number): void;
|
1214 | export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1215 | export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1216 | export function chmodSync(path: string, mode: number): void;
|
1217 | export function chmodSync(path: string, mode: string): void;
|
1218 | export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1219 | export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1220 | export function fchmodSync(fd: number, mode: number): void;
|
1221 | export function fchmodSync(fd: number, mode: string): void;
|
1222 | export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1223 | export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1224 | export function lchmodSync(path: string, mode: number): void;
|
1225 | export function lchmodSync(path: string, mode: string): void;
|
1226 | export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
1227 | export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
1228 | export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
1229 | export function statSync(path: string): Stats;
|
1230 | export function lstatSync(path: string): Stats;
|
1231 | export function fstatSync(fd: number): Stats;
|
1232 | export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1233 | export function linkSync(srcpath: string, dstpath: string): void;
|
1234 | export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1235 | export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
|
1236 | export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
1237 | export function readlinkSync(path: string): string;
|
1238 | export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
1239 | export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void;
|
1240 | export function realpathSync(path: string, cache?: { [path: string]: string }): string;
|
1241 | |
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 | export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1248 | |
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | export function unlinkSync(path: string): void;
|
1254 | |
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 | export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1261 | |
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 | export function rmdirSync(path: string): void;
|
1267 | |
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 | export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1274 | |
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 | export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1282 | |
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 | export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1290 | |
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 | export function mkdirSync(path: string, mode?: number): void;
|
1298 | |
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 | export function mkdirSync(path: string, mode?: string): void;
|
1306 | export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
1307 | export function readdirSync(path: string): string[];
|
1308 | export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1309 | export function closeSync(fd: number): void;
|
1310 | export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
1311 | export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
1312 | export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
1313 | export function openSync(path: string, flags: string, mode?: number): number;
|
1314 | export function openSync(path: string, flags: string, mode?: string): number;
|
1315 | export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1316 | export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1317 | export function utimesSync(path: string, atime: number, mtime: number): void;
|
1318 | export function utimesSync(path: string, atime: Date, mtime: Date): void;
|
1319 | export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1320 | export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1321 | export function futimesSync(fd: number, atime: number, mtime: number): void;
|
1322 | export function futimesSync(fd: number, atime: Date, mtime: Date): void;
|
1323 | export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
1324 | export function fsyncSync(fd: number): void;
|
1325 | export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
1326 | export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
1327 | export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
1328 | export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
1329 | export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
1330 | export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
1331 | export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
1332 | export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
1333 | |
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 | export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
1341 | |
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 | export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
1349 | |
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 | export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
1357 | |
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 | export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
1364 | |
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 | export function readFileSync(filename: string, encoding: string): string;
|
1371 | |
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 | export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string;
|
1378 | |
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 | export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
|
1385 | export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
1386 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
1387 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
1388 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
1389 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
1390 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
1391 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
1392 | export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
1393 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
1394 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
1395 | export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;
|
1396 | export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
|
1397 | export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
|
1398 | export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
1399 | export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
|
1400 | export function exists(path: string, callback?: (exists: boolean) => void): void;
|
1401 | export function existsSync(path: string): boolean;
|
1402 |
|
1403 | export var F_OK: number;
|
1404 |
|
1405 | export var R_OK: number;
|
1406 |
|
1407 | export var W_OK: number;
|
1408 |
|
1409 | export var X_OK: number;
|
1410 |
|
1411 | export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
1412 | export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
1413 |
|
1414 | export function accessSync(path: string, mode ?: number): void;
|
1415 | export function createReadStream(path: string, options?: {
|
1416 | flags?: string;
|
1417 | encoding?: string;
|
1418 | fd?: number;
|
1419 | mode?: number;
|
1420 | autoClose?: boolean;
|
1421 | }): ReadStream;
|
1422 | export function createWriteStream(path: string, options?: {
|
1423 | flags?: string;
|
1424 | encoding?: string;
|
1425 | fd?: number;
|
1426 | mode?: number;
|
1427 | }): WriteStream;
|
1428 | }
|
1429 |
|
1430 | declare module "path" {
|
1431 |
|
1432 | |
1433 |
|
1434 |
|
1435 | export interface ParsedPath {
|
1436 | |
1437 |
|
1438 |
|
1439 | root: string;
|
1440 | |
1441 |
|
1442 |
|
1443 | dir: string;
|
1444 | |
1445 |
|
1446 |
|
1447 | base: string;
|
1448 | |
1449 |
|
1450 |
|
1451 | ext: string;
|
1452 | |
1453 |
|
1454 |
|
1455 | name: string;
|
1456 | }
|
1457 |
|
1458 | |
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 | export function normalize(p: string): string;
|
1465 | |
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 | export function join(...paths: any[]): string;
|
1472 | |
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 | export function join(...paths: string[]): string;
|
1479 | |
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 | export function resolve(...pathSegments: any[]): string;
|
1489 | |
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 | export function isAbsolute(path: string): boolean;
|
1495 | |
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 | export function relative(from: string, to: string): string;
|
1503 | |
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 | export function dirname(p: string): string;
|
1509 | |
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 | export function basename(p: string, ext?: string): string;
|
1517 | |
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 | export function extname(p: string): string;
|
1524 | |
1525 |
|
1526 |
|
1527 | export var sep: string;
|
1528 | |
1529 |
|
1530 |
|
1531 | export var delimiter: string;
|
1532 | |
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 | export function parse(pathString: string): ParsedPath;
|
1538 | |
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 | export function format(pathObject: ParsedPath): string;
|
1544 |
|
1545 | export module posix {
|
1546 | export function normalize(p: string): string;
|
1547 | export function join(...paths: any[]): string;
|
1548 | export function resolve(...pathSegments: any[]): string;
|
1549 | export function isAbsolute(p: string): boolean;
|
1550 | export function relative(from: string, to: string): string;
|
1551 | export function dirname(p: string): string;
|
1552 | export function basename(p: string, ext?: string): string;
|
1553 | export function extname(p: string): string;
|
1554 | export var sep: string;
|
1555 | export var delimiter: string;
|
1556 | export function parse(p: string): ParsedPath;
|
1557 | export function format(pP: ParsedPath): string;
|
1558 | }
|
1559 |
|
1560 | export module win32 {
|
1561 | export function normalize(p: string): string;
|
1562 | export function join(...paths: any[]): string;
|
1563 | export function resolve(...pathSegments: any[]): string;
|
1564 | export function isAbsolute(p: string): boolean;
|
1565 | export function relative(from: string, to: string): string;
|
1566 | export function dirname(p: string): string;
|
1567 | export function basename(p: string, ext?: string): string;
|
1568 | export function extname(p: string): string;
|
1569 | export var sep: string;
|
1570 | export var delimiter: string;
|
1571 | export function parse(p: string): ParsedPath;
|
1572 | export function format(pP: ParsedPath): string;
|
1573 | }
|
1574 | }
|
1575 |
|
1576 | declare module "string_decoder" {
|
1577 | export interface NodeStringDecoder {
|
1578 | write(buffer: Buffer): string;
|
1579 | detectIncompleteChar(buffer: Buffer): number;
|
1580 | }
|
1581 | export var StringDecoder: {
|
1582 | new (encoding: string): NodeStringDecoder;
|
1583 | };
|
1584 | }
|
1585 |
|
1586 | declare module "tls" {
|
1587 | import * as crypto from "crypto";
|
1588 | import * as net from "net";
|
1589 | import * as stream from "stream";
|
1590 |
|
1591 | var CLIENT_RENEG_LIMIT: number;
|
1592 | var CLIENT_RENEG_WINDOW: number;
|
1593 |
|
1594 | export interface TlsOptions {
|
1595 | host?: string;
|
1596 | port?: number;
|
1597 | pfx?: any;
|
1598 | key?: any;
|
1599 | passphrase?: string;
|
1600 | cert?: any;
|
1601 | ca?: any;
|
1602 | crl?: any;
|
1603 | ciphers?: string;
|
1604 | honorCipherOrder?: any;
|
1605 | requestCert?: boolean;
|
1606 | rejectUnauthorized?: boolean;
|
1607 | NPNProtocols?: any;
|
1608 | SNICallback?: (servername: string) => any;
|
1609 | }
|
1610 |
|
1611 | export interface ConnectionOptions {
|
1612 | host?: string;
|
1613 | port?: number;
|
1614 | socket?: net.Socket;
|
1615 | pfx?: any;
|
1616 | key?: any;
|
1617 | passphrase?: string;
|
1618 | cert?: any;
|
1619 | ca?: any;
|
1620 | rejectUnauthorized?: boolean;
|
1621 | NPNProtocols?: any;
|
1622 | servername?: string;
|
1623 | }
|
1624 |
|
1625 | export interface Server extends net.Server {
|
1626 |
|
1627 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server;
|
1628 | listen(path: string, listeningListener?: Function): Server;
|
1629 | listen(handle: any, listeningListener?: Function): Server;
|
1630 |
|
1631 | listen(port: number, host?: string, callback?: Function): Server;
|
1632 | close(): Server;
|
1633 | address(): { port: number; family: string; address: string; };
|
1634 | addContext(hostName: string, credentials: {
|
1635 | key: string;
|
1636 | cert: string;
|
1637 | ca: string;
|
1638 | }): void;
|
1639 | maxConnections: number;
|
1640 | connections: number;
|
1641 | }
|
1642 |
|
1643 | export interface ClearTextStream extends stream.Duplex {
|
1644 | authorized: boolean;
|
1645 | authorizationError: Error;
|
1646 | getPeerCertificate(): any;
|
1647 | getCipher: {
|
1648 | name: string;
|
1649 | version: string;
|
1650 | };
|
1651 | address: {
|
1652 | port: number;
|
1653 | family: string;
|
1654 | address: string;
|
1655 | };
|
1656 | remoteAddress: string;
|
1657 | remotePort: number;
|
1658 | }
|
1659 |
|
1660 | export interface SecurePair {
|
1661 | encrypted: any;
|
1662 | cleartext: any;
|
1663 | }
|
1664 |
|
1665 | export interface SecureContextOptions {
|
1666 | pfx?: any;
|
1667 | key?: any;
|
1668 | passphrase?: string;
|
1669 | cert?: any;
|
1670 | ca?: any;
|
1671 | crl?: any;
|
1672 | ciphers?: string;
|
1673 | honorCipherOrder?: boolean;
|
1674 | }
|
1675 |
|
1676 | export interface SecureContext {
|
1677 | context: any;
|
1678 | }
|
1679 |
|
1680 | export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server;
|
1681 | export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream;
|
1682 | export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
1683 | export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
1684 | export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
1685 | export function createSecureContext(details: SecureContextOptions): SecureContext;
|
1686 | }
|
1687 |
|
1688 | declare module "crypto" {
|
1689 | export interface CredentialDetails {
|
1690 | pfx: string;
|
1691 | key: string;
|
1692 | passphrase: string;
|
1693 | cert: string;
|
1694 | ca: any;
|
1695 | crl: any;
|
1696 | ciphers: string;
|
1697 | }
|
1698 | export interface Credentials { context?: any; }
|
1699 | export function createCredentials(details: CredentialDetails): Credentials;
|
1700 | export function createHash(algorithm: string): Hash;
|
1701 | export function createHmac(algorithm: string, key: string): Hmac;
|
1702 | export function createHmac(algorithm: string, key: Buffer): Hmac;
|
1703 | export interface Hash {
|
1704 | update(data: any, input_encoding?: string): Hash;
|
1705 | digest(encoding: 'buffer'): Buffer;
|
1706 | digest(encoding: string): any;
|
1707 | digest(): Buffer;
|
1708 | }
|
1709 | export interface Hmac extends NodeJS.ReadWriteStream {
|
1710 | update(data: any, input_encoding?: string): Hmac;
|
1711 | digest(encoding: 'buffer'): Buffer;
|
1712 | digest(encoding: string): any;
|
1713 | digest(): Buffer;
|
1714 | }
|
1715 | export function createCipher(algorithm: string, password: any): Cipher;
|
1716 | export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
1717 | export interface Cipher {
|
1718 | update(data: Buffer): Buffer;
|
1719 | update(data: string, input_encoding?: string, output_encoding?: string): string;
|
1720 | final(): Buffer;
|
1721 | final(output_encoding: string): string;
|
1722 | setAutoPadding(auto_padding: boolean): void;
|
1723 | }
|
1724 | export function createDecipher(algorithm: string, password: any): Decipher;
|
1725 | export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
1726 | export interface Decipher {
|
1727 | update(data: Buffer): Buffer;
|
1728 | update(data: string, input_encoding?: string, output_encoding?: string): string;
|
1729 | final(): Buffer;
|
1730 | final(output_encoding: string): string;
|
1731 | setAutoPadding(auto_padding: boolean): void;
|
1732 | }
|
1733 | export function createSign(algorithm: string): Signer;
|
1734 | export interface Signer extends NodeJS.WritableStream {
|
1735 | update(data: any): void;
|
1736 | sign(private_key: string, output_format: string): string;
|
1737 | }
|
1738 | export function createVerify(algorith: string): Verify;
|
1739 | export interface Verify extends NodeJS.WritableStream {
|
1740 | update(data: any): void;
|
1741 | verify(object: string, signature: string, signature_format?: string): boolean;
|
1742 | }
|
1743 | export function createDiffieHellman(prime_length: number): DiffieHellman;
|
1744 | export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
|
1745 | export interface DiffieHellman {
|
1746 | generateKeys(encoding?: string): string;
|
1747 | computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
|
1748 | getPrime(encoding?: string): string;
|
1749 | getGenerator(encoding: string): string;
|
1750 | getPublicKey(encoding?: string): string;
|
1751 | getPrivateKey(encoding?: string): string;
|
1752 | setPublicKey(public_key: string, encoding?: string): void;
|
1753 | setPrivateKey(public_key: string, encoding?: string): void;
|
1754 | }
|
1755 | export function getDiffieHellman(group_name: string): DiffieHellman;
|
1756 | export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
1757 | export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
1758 | export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer;
|
1759 | export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer;
|
1760 | export function randomBytes(size: number): Buffer;
|
1761 | export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
1762 | export function pseudoRandomBytes(size: number): Buffer;
|
1763 | export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
1764 | export interface RsaPublicKey {
|
1765 | key: string;
|
1766 | padding?: any;
|
1767 | }
|
1768 | export interface RsaPrivateKey {
|
1769 | key: string;
|
1770 | passphrase?: string,
|
1771 | padding?: any;
|
1772 | }
|
1773 | export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer
|
1774 | export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer
|
1775 | }
|
1776 |
|
1777 | declare module "stream" {
|
1778 | import * as events from "events";
|
1779 |
|
1780 | export class Stream extends events.EventEmitter {
|
1781 | pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
1782 | }
|
1783 |
|
1784 | export interface ReadableOptions {
|
1785 | highWaterMark?: number;
|
1786 | encoding?: string;
|
1787 | objectMode?: boolean;
|
1788 | }
|
1789 |
|
1790 | export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
1791 | readable: boolean;
|
1792 | constructor(opts?: ReadableOptions);
|
1793 | _read(size: number): void;
|
1794 | read(size?: number): any;
|
1795 | setEncoding(encoding: string): void;
|
1796 | pause(): void;
|
1797 | resume(): void;
|
1798 | pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
1799 | unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
1800 | unshift(chunk: any): void;
|
1801 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
1802 | push(chunk: any, encoding?: string): boolean;
|
1803 | }
|
1804 |
|
1805 | export interface WritableOptions {
|
1806 | highWaterMark?: number;
|
1807 | decodeStrings?: boolean;
|
1808 | objectMode?: boolean;
|
1809 | }
|
1810 |
|
1811 | export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
1812 | writable: boolean;
|
1813 | constructor(opts?: WritableOptions);
|
1814 | _write(chunk: any, encoding: string, callback: Function): void;
|
1815 | write(chunk: any, cb?: Function): boolean;
|
1816 | write(chunk: any, encoding?: string, cb?: Function): boolean;
|
1817 | end(): void;
|
1818 | end(chunk: any, cb?: Function): void;
|
1819 | end(chunk: any, encoding?: string, cb?: Function): void;
|
1820 | }
|
1821 |
|
1822 | export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
1823 | allowHalfOpen?: boolean;
|
1824 | }
|
1825 |
|
1826 |
|
1827 | export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
1828 | writable: boolean;
|
1829 | constructor(opts?: DuplexOptions);
|
1830 | _write(chunk: any, encoding: string, callback: Function): void;
|
1831 | write(chunk: any, cb?: Function): boolean;
|
1832 | write(chunk: any, encoding?: string, cb?: Function): boolean;
|
1833 | end(): void;
|
1834 | end(chunk: any, cb?: Function): void;
|
1835 | end(chunk: any, encoding?: string, cb?: Function): void;
|
1836 | }
|
1837 |
|
1838 | export interface TransformOptions extends ReadableOptions, WritableOptions {}
|
1839 |
|
1840 |
|
1841 | export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
|
1842 | readable: boolean;
|
1843 | writable: boolean;
|
1844 | constructor(opts?: TransformOptions);
|
1845 | _transform(chunk: any, encoding: string, callback: Function): void;
|
1846 | _flush(callback: Function): void;
|
1847 | read(size?: number): any;
|
1848 | setEncoding(encoding: string): void;
|
1849 | pause(): void;
|
1850 | resume(): void;
|
1851 | pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
1852 | unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
1853 | unshift(chunk: any): void;
|
1854 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
1855 | push(chunk: any, encoding?: string): boolean;
|
1856 | write(chunk: any, cb?: Function): boolean;
|
1857 | write(chunk: any, encoding?: string, cb?: Function): boolean;
|
1858 | end(): void;
|
1859 | end(chunk: any, cb?: Function): void;
|
1860 | end(chunk: any, encoding?: string, cb?: Function): void;
|
1861 | }
|
1862 |
|
1863 | export class PassThrough extends Transform {}
|
1864 | }
|
1865 |
|
1866 | declare module "util" {
|
1867 | export interface InspectOptions {
|
1868 | showHidden?: boolean;
|
1869 | depth?: number;
|
1870 | colors?: boolean;
|
1871 | customInspect?: boolean;
|
1872 | }
|
1873 |
|
1874 | export function format(format: any, ...param: any[]): string;
|
1875 | export function debug(string: string): void;
|
1876 | export function error(...param: any[]): void;
|
1877 | export function puts(...param: any[]): void;
|
1878 | export function print(...param: any[]): void;
|
1879 | export function log(string: string): void;
|
1880 | export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string;
|
1881 | export function inspect(object: any, options: InspectOptions): string;
|
1882 | export function isArray(object: any): boolean;
|
1883 | export function isRegExp(object: any): boolean;
|
1884 | export function isDate(object: any): boolean;
|
1885 | export function isError(object: any): boolean;
|
1886 | export function inherits(constructor: any, superConstructor: any): void;
|
1887 | export function debuglog(key:string): (msg:string,...param: any[])=>void;
|
1888 | }
|
1889 |
|
1890 | declare module "assert" {
|
1891 | function internal (value: any, message?: string): void;
|
1892 | module internal {
|
1893 | export class AssertionError implements Error {
|
1894 | name: string;
|
1895 | message: string;
|
1896 | actual: any;
|
1897 | expected: any;
|
1898 | operator: string;
|
1899 | generatedMessage: boolean;
|
1900 |
|
1901 | constructor(options?: {message?: string; actual?: any; expected?: any;
|
1902 | operator?: string; stackStartFunction?: Function});
|
1903 | }
|
1904 |
|
1905 | export function fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
1906 | export function ok(value: any, message?: string): void;
|
1907 | export function equal(actual: any, expected: any, message?: string): void;
|
1908 | export function notEqual(actual: any, expected: any, message?: string): void;
|
1909 | export function deepEqual(actual: any, expected: any, message?: string): void;
|
1910 | export function notDeepEqual(acutal: any, expected: any, message?: string): void;
|
1911 | export function strictEqual(actual: any, expected: any, message?: string): void;
|
1912 | export function notStrictEqual(actual: any, expected: any, message?: string): void;
|
1913 | export function deepStrictEqual(actual: any, expected: any, message?: string): void;
|
1914 | export function notDeepStrictEqual(actual: any, expected: any, message?: string): void;
|
1915 | export var throws: {
|
1916 | (block: Function, message?: string): void;
|
1917 | (block: Function, error: Function, message?: string): void;
|
1918 | (block: Function, error: RegExp, message?: string): void;
|
1919 | (block: Function, error: (err: any) => boolean, message?: string): void;
|
1920 | };
|
1921 |
|
1922 | export var doesNotThrow: {
|
1923 | (block: Function, message?: string): void;
|
1924 | (block: Function, error: Function, message?: string): void;
|
1925 | (block: Function, error: RegExp, message?: string): void;
|
1926 | (block: Function, error: (err: any) => boolean, message?: string): void;
|
1927 | };
|
1928 |
|
1929 | export function ifError(value: any): void;
|
1930 | }
|
1931 |
|
1932 | export = internal;
|
1933 | }
|
1934 |
|
1935 | declare module "tty" {
|
1936 | import * as net from "net";
|
1937 |
|
1938 | export function isatty(fd: number): boolean;
|
1939 | export interface ReadStream extends net.Socket {
|
1940 | isRaw: boolean;
|
1941 | setRawMode(mode: boolean): void;
|
1942 | isTTY: boolean;
|
1943 | }
|
1944 | export interface WriteStream extends net.Socket {
|
1945 | columns: number;
|
1946 | rows: number;
|
1947 | isTTY: boolean;
|
1948 | }
|
1949 | }
|
1950 |
|
1951 | declare module "domain" {
|
1952 | import * as events from "events";
|
1953 |
|
1954 | export class Domain extends events.EventEmitter {
|
1955 | run(fn: Function): void;
|
1956 | add(emitter: events.EventEmitter): void;
|
1957 | remove(emitter: events.EventEmitter): void;
|
1958 | bind(cb: (err: Error, data: any) => any): any;
|
1959 | intercept(cb: (data: any) => any): any;
|
1960 | dispose(): void;
|
1961 |
|
1962 | addListener(event: string, listener: Function): Domain;
|
1963 | on(event: string, listener: Function): Domain;
|
1964 | once(event: string, listener: Function): Domain;
|
1965 | removeListener(event: string, listener: Function): Domain;
|
1966 | removeAllListeners(event?: string): Domain;
|
1967 | }
|
1968 |
|
1969 | export function create(): Domain;
|
1970 | }
|
1971 |
|
1972 | declare module "constants" {
|
1973 | export var E2BIG: number;
|
1974 | export var EACCES: number;
|
1975 | export var EADDRINUSE: number;
|
1976 | export var EADDRNOTAVAIL: number;
|
1977 | export var EAFNOSUPPORT: number;
|
1978 | export var EAGAIN: number;
|
1979 | export var EALREADY: number;
|
1980 | export var EBADF: number;
|
1981 | export var EBADMSG: number;
|
1982 | export var EBUSY: number;
|
1983 | export var ECANCELED: number;
|
1984 | export var ECHILD: number;
|
1985 | export var ECONNABORTED: number;
|
1986 | export var ECONNREFUSED: number;
|
1987 | export var ECONNRESET: number;
|
1988 | export var EDEADLK: number;
|
1989 | export var EDESTADDRREQ: number;
|
1990 | export var EDOM: number;
|
1991 | export var EEXIST: number;
|
1992 | export var EFAULT: number;
|
1993 | export var EFBIG: number;
|
1994 | export var EHOSTUNREACH: number;
|
1995 | export var EIDRM: number;
|
1996 | export var EILSEQ: number;
|
1997 | export var EINPROGRESS: number;
|
1998 | export var EINTR: number;
|
1999 | export var EINVAL: number;
|
2000 | export var EIO: number;
|
2001 | export var EISCONN: number;
|
2002 | export var EISDIR: number;
|
2003 | export var ELOOP: number;
|
2004 | export var EMFILE: number;
|
2005 | export var EMLINK: number;
|
2006 | export var EMSGSIZE: number;
|
2007 | export var ENAMETOOLONG: number;
|
2008 | export var ENETDOWN: number;
|
2009 | export var ENETRESET: number;
|
2010 | export var ENETUNREACH: number;
|
2011 | export var ENFILE: number;
|
2012 | export var ENOBUFS: number;
|
2013 | export var ENODATA: number;
|
2014 | export var ENODEV: number;
|
2015 | export var ENOENT: number;
|
2016 | export var ENOEXEC: number;
|
2017 | export var ENOLCK: number;
|
2018 | export var ENOLINK: number;
|
2019 | export var ENOMEM: number;
|
2020 | export var ENOMSG: number;
|
2021 | export var ENOPROTOOPT: number;
|
2022 | export var ENOSPC: number;
|
2023 | export var ENOSR: number;
|
2024 | export var ENOSTR: number;
|
2025 | export var ENOSYS: number;
|
2026 | export var ENOTCONN: number;
|
2027 | export var ENOTDIR: number;
|
2028 | export var ENOTEMPTY: number;
|
2029 | export var ENOTSOCK: number;
|
2030 | export var ENOTSUP: number;
|
2031 | export var ENOTTY: number;
|
2032 | export var ENXIO: number;
|
2033 | export var EOPNOTSUPP: number;
|
2034 | export var EOVERFLOW: number;
|
2035 | export var EPERM: number;
|
2036 | export var EPIPE: number;
|
2037 | export var EPROTO: number;
|
2038 | export var EPROTONOSUPPORT: number;
|
2039 | export var EPROTOTYPE: number;
|
2040 | export var ERANGE: number;
|
2041 | export var EROFS: number;
|
2042 | export var ESPIPE: number;
|
2043 | export var ESRCH: number;
|
2044 | export var ETIME: number;
|
2045 | export var ETIMEDOUT: number;
|
2046 | export var ETXTBSY: number;
|
2047 | export var EWOULDBLOCK: number;
|
2048 | export var EXDEV: number;
|
2049 | export var WSAEINTR: number;
|
2050 | export var WSAEBADF: number;
|
2051 | export var WSAEACCES: number;
|
2052 | export var WSAEFAULT: number;
|
2053 | export var WSAEINVAL: number;
|
2054 | export var WSAEMFILE: number;
|
2055 | export var WSAEWOULDBLOCK: number;
|
2056 | export var WSAEINPROGRESS: number;
|
2057 | export var WSAEALREADY: number;
|
2058 | export var WSAENOTSOCK: number;
|
2059 | export var WSAEDESTADDRREQ: number;
|
2060 | export var WSAEMSGSIZE: number;
|
2061 | export var WSAEPROTOTYPE: number;
|
2062 | export var WSAENOPROTOOPT: number;
|
2063 | export var WSAEPROTONOSUPPORT: number;
|
2064 | export var WSAESOCKTNOSUPPORT: number;
|
2065 | export var WSAEOPNOTSUPP: number;
|
2066 | export var WSAEPFNOSUPPORT: number;
|
2067 | export var WSAEAFNOSUPPORT: number;
|
2068 | export var WSAEADDRINUSE: number;
|
2069 | export var WSAEADDRNOTAVAIL: number;
|
2070 | export var WSAENETDOWN: number;
|
2071 | export var WSAENETUNREACH: number;
|
2072 | export var WSAENETRESET: number;
|
2073 | export var WSAECONNABORTED: number;
|
2074 | export var WSAECONNRESET: number;
|
2075 | export var WSAENOBUFS: number;
|
2076 | export var WSAEISCONN: number;
|
2077 | export var WSAENOTCONN: number;
|
2078 | export var WSAESHUTDOWN: number;
|
2079 | export var WSAETOOMANYREFS: number;
|
2080 | export var WSAETIMEDOUT: number;
|
2081 | export var WSAECONNREFUSED: number;
|
2082 | export var WSAELOOP: number;
|
2083 | export var WSAENAMETOOLONG: number;
|
2084 | export var WSAEHOSTDOWN: number;
|
2085 | export var WSAEHOSTUNREACH: number;
|
2086 | export var WSAENOTEMPTY: number;
|
2087 | export var WSAEPROCLIM: number;
|
2088 | export var WSAEUSERS: number;
|
2089 | export var WSAEDQUOT: number;
|
2090 | export var WSAESTALE: number;
|
2091 | export var WSAEREMOTE: number;
|
2092 | export var WSASYSNOTREADY: number;
|
2093 | export var WSAVERNOTSUPPORTED: number;
|
2094 | export var WSANOTINITIALISED: number;
|
2095 | export var WSAEDISCON: number;
|
2096 | export var WSAENOMORE: number;
|
2097 | export var WSAECANCELLED: number;
|
2098 | export var WSAEINVALIDPROCTABLE: number;
|
2099 | export var WSAEINVALIDPROVIDER: number;
|
2100 | export var WSAEPROVIDERFAILEDINIT: number;
|
2101 | export var WSASYSCALLFAILURE: number;
|
2102 | export var WSASERVICE_NOT_FOUND: number;
|
2103 | export var WSATYPE_NOT_FOUND: number;
|
2104 | export var WSA_E_NO_MORE: number;
|
2105 | export var WSA_E_CANCELLED: number;
|
2106 | export var WSAEREFUSED: number;
|
2107 | export var SIGHUP: number;
|
2108 | export var SIGINT: number;
|
2109 | export var SIGILL: number;
|
2110 | export var SIGABRT: number;
|
2111 | export var SIGFPE: number;
|
2112 | export var SIGKILL: number;
|
2113 | export var SIGSEGV: number;
|
2114 | export var SIGTERM: number;
|
2115 | export var SIGBREAK: number;
|
2116 | export var SIGWINCH: number;
|
2117 | export var SSL_OP_ALL: number;
|
2118 | export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
|
2119 | export var SSL_OP_CIPHER_SERVER_PREFERENCE: number;
|
2120 | export var SSL_OP_CISCO_ANYCONNECT: number;
|
2121 | export var SSL_OP_COOKIE_EXCHANGE: number;
|
2122 | export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
|
2123 | export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
|
2124 | export var SSL_OP_EPHEMERAL_RSA: number;
|
2125 | export var SSL_OP_LEGACY_SERVER_CONNECT: number;
|
2126 | export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
|
2127 | export var SSL_OP_MICROSOFT_SESS_ID_BUG: number;
|
2128 | export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
|
2129 | export var SSL_OP_NETSCAPE_CA_DN_BUG: number;
|
2130 | export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
|
2131 | export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
|
2132 | export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
|
2133 | export var SSL_OP_NO_COMPRESSION: number;
|
2134 | export var SSL_OP_NO_QUERY_MTU: number;
|
2135 | export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
|
2136 | export var SSL_OP_NO_SSLv2: number;
|
2137 | export var SSL_OP_NO_SSLv3: number;
|
2138 | export var SSL_OP_NO_TICKET: number;
|
2139 | export var SSL_OP_NO_TLSv1: number;
|
2140 | export var SSL_OP_NO_TLSv1_1: number;
|
2141 | export var SSL_OP_NO_TLSv1_2: number;
|
2142 | export var SSL_OP_PKCS1_CHECK_1: number;
|
2143 | export var SSL_OP_PKCS1_CHECK_2: number;
|
2144 | export var SSL_OP_SINGLE_DH_USE: number;
|
2145 | export var SSL_OP_SINGLE_ECDH_USE: number;
|
2146 | export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
|
2147 | export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
|
2148 | export var SSL_OP_TLS_BLOCK_PADDING_BUG: number;
|
2149 | export var SSL_OP_TLS_D5_BUG: number;
|
2150 | export var SSL_OP_TLS_ROLLBACK_BUG: number;
|
2151 | export var ENGINE_METHOD_DSA: number;
|
2152 | export var ENGINE_METHOD_DH: number;
|
2153 | export var ENGINE_METHOD_RAND: number;
|
2154 | export var ENGINE_METHOD_ECDH: number;
|
2155 | export var ENGINE_METHOD_ECDSA: number;
|
2156 | export var ENGINE_METHOD_CIPHERS: number;
|
2157 | export var ENGINE_METHOD_DIGESTS: number;
|
2158 | export var ENGINE_METHOD_STORE: number;
|
2159 | export var ENGINE_METHOD_PKEY_METHS: number;
|
2160 | export var ENGINE_METHOD_PKEY_ASN1_METHS: number;
|
2161 | export var ENGINE_METHOD_ALL: number;
|
2162 | export var ENGINE_METHOD_NONE: number;
|
2163 | export var DH_CHECK_P_NOT_SAFE_PRIME: number;
|
2164 | export var DH_CHECK_P_NOT_PRIME: number;
|
2165 | export var DH_UNABLE_TO_CHECK_GENERATOR: number;
|
2166 | export var DH_NOT_SUITABLE_GENERATOR: number;
|
2167 | export var NPN_ENABLED: number;
|
2168 | export var RSA_PKCS1_PADDING: number;
|
2169 | export var RSA_SSLV23_PADDING: number;
|
2170 | export var RSA_NO_PADDING: number;
|
2171 | export var RSA_PKCS1_OAEP_PADDING: number;
|
2172 | export var RSA_X931_PADDING: number;
|
2173 | export var RSA_PKCS1_PSS_PADDING: number;
|
2174 | export var POINT_CONVERSION_COMPRESSED: number;
|
2175 | export var POINT_CONVERSION_UNCOMPRESSED: number;
|
2176 | export var POINT_CONVERSION_HYBRID: number;
|
2177 | export var O_RDONLY: number;
|
2178 | export var O_WRONLY: number;
|
2179 | export var O_RDWR: number;
|
2180 | export var S_IFMT: number;
|
2181 | export var S_IFREG: number;
|
2182 | export var S_IFDIR: number;
|
2183 | export var S_IFCHR: number;
|
2184 | export var S_IFLNK: number;
|
2185 | export var O_CREAT: number;
|
2186 | export var O_EXCL: number;
|
2187 | export var O_TRUNC: number;
|
2188 | export var O_APPEND: number;
|
2189 | export var F_OK: number;
|
2190 | export var R_OK: number;
|
2191 | export var W_OK: number;
|
2192 | export var X_OK: number;
|
2193 | export var UV_UDP_REUSEADDR: number;
|
2194 | }
|