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