Advertisement
Guest User

Untitled

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