@types/node 8.0.41 → 8.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. node/README.md +1 -1
  2. node/index.d.ts +102 -40
  3. node/package.json +2 -2
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
9
9
 
10
10
  Additional Details
11
- * Last updated: Tue, 17 Oct 2017 00:14:44 GMT
11
+ * Last updated: Wed, 18 Oct 2017 20:09:19 GMT
12
12
  * Dependencies: events, net, stream, url, child_process, tls, http, readline, dns, crypto, fs
13
13
  * Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
14
14
 
node/index.d.ts CHANGED
@@ -108,10 +108,10 @@ interface NodeRequire extends NodeRequireFunction {
108
108
  }
109
109
 
110
110
  interface NodeExtensions {
111
- '.js': (m: NodeModule, filename: string) => any;
112
- '.json': (m: NodeModule, filename: string) => any;
113
- '.node': (m: NodeModule, filename: string) => any;
114
- [ext: string]: (m: NodeModule, filename: string) => any;
111
+ '.js': (m: NodeModule, filename: string) => any;
112
+ '.json': (m: NodeModule, filename: string) => any;
113
+ '.node': (m: NodeModule, filename: string) => any;
114
+ [ext: string]: (m: NodeModule, filename: string) => any;
115
115
  }
116
116
 
117
117
  declare var require: NodeRequire;
@@ -345,7 +345,7 @@ declare namespace NodeJS {
345
345
  unpipe<T extends WritableStream>(destination?: T): this;
346
346
  unshift(chunk: string): void;
347
347
  unshift(chunk: Buffer): void;
348
- wrap(oldStream: ReadableStream): ReadableStream;
348
+ wrap(oldStream: ReadableStream): this;
349
349
  }
350
350
 
351
351
  export interface WritableStream extends EventEmitter {
@@ -438,10 +438,21 @@ declare namespace NodeJS {
438
438
  export interface WriteStream extends Socket {
439
439
  columns?: number;
440
440
  rows?: number;
441
+ _write(chunk: any, encoding: string, callback: Function): void;
442
+ _destroy(err: Error, callback: Function): void;
443
+ _final(callback: Function): void;
444
+ setDefaultEncoding(encoding: string): this;
445
+ cork(): void;
446
+ uncork(): void;
447
+ destroy(error?: Error): void;
441
448
  }
442
449
  export interface ReadStream extends Socket {
443
450
  isRaw?: boolean;
444
451
  setRawMode?(mode: boolean): void;
452
+ _read(size: number): void;
453
+ _destroy(err: Error, callback: Function): void;
454
+ push(chunk: any, encoding?: string): boolean;
455
+ destroy(error?: Error): void;
445
456
  }
446
457
 
447
458
  export interface Process extends EventEmitter {
@@ -786,7 +797,7 @@ declare module "querystring" {
786
797
  }
787
798
 
788
799
  export function stringify<T>(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string;
789
- export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any;
800
+ export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): { [key: string]: string | string[] };
790
801
  export function parse<T extends {}>(str: string, sep?: string, eq?: string, options?: ParseOptions): T;
791
802
  export function escape(str: string): string;
792
803
  export function unescape(str: string): string;
@@ -2160,37 +2171,29 @@ declare module "child_process" {
2160
2171
  }
2161
2172
 
2162
2173
  declare module "url" {
2163
- export interface Url {
2164
- href?: string;
2165
- protocol?: string;
2174
+ export interface UrlObject {
2166
2175
  auth?: string;
2167
- hostname?: string;
2168
- port?: string;
2176
+ hash?: string;
2169
2177
  host?: string;
2178
+ hostname?: string;
2179
+ href?: string;
2180
+ path?: string;
2170
2181
  pathname?: string;
2182
+ port?: string | number;
2183
+ protocol?: string;
2184
+ query?: string | null | { [key: string]: string | string[] };
2171
2185
  search?: string;
2172
- query?: string | any;
2173
2186
  slashes?: boolean;
2174
- hash?: string;
2175
- path?: string;
2176
2187
  }
2177
2188
 
2178
- export interface UrlObject {
2179
- protocol?: string;
2180
- slashes?: boolean;
2181
- auth?: string;
2182
- host?: string;
2183
- hostname?: string;
2184
- port?: string | number;
2185
- pathname?: string;
2186
- search?: string;
2187
- query?: { [key: string]: any; };
2188
- hash?: string;
2189
+ export interface Url extends UrlObject {
2190
+ port?: string;
2191
+ query?: any;
2189
2192
  }
2190
2193
 
2191
2194
  export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url;
2192
2195
  export function format(URL: URL, options?: URLFormatOptions): string;
2193
- export function format(urlObject: UrlObject): string;
2196
+ export function format(urlObject: UrlObject | string): string;
2194
2197
  export function resolve(from: string, to: string): string;
2195
2198
 
2196
2199
  export interface URLFormatOptions {
@@ -2430,7 +2433,9 @@ declare module "net" {
2430
2433
 
2431
2434
  export type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
2432
2435
 
2433
- export interface Socket extends stream.Duplex {
2436
+ export class Socket extends stream.Duplex {
2437
+ constructor(options?: { fd?: number; allowHalfOpen?: boolean; readable?: boolean; writable?: boolean; });
2438
+
2434
2439
  // Extended base methods
2435
2440
  write(buffer: Buffer): boolean;
2436
2441
  write(buffer: Buffer, cb?: Function): boolean;
@@ -2544,10 +2549,6 @@ declare module "net" {
2544
2549
  prependOnceListener(event: "timeout", listener: () => void): this;
2545
2550
  }
2546
2551
 
2547
- export var Socket: {
2548
- new(options?: SocketConstructorOpts): Socket;
2549
- };
2550
-
2551
2552
  export interface ListenOptions {
2552
2553
  port?: number;
2553
2554
  host?: string;
@@ -2648,6 +2649,7 @@ declare module "net" {
2648
2649
 
2649
2650
  declare module "dgram" {
2650
2651
  import * as events from "events";
2652
+ import * as dns from "dns";
2651
2653
 
2652
2654
  interface RemoteInfo {
2653
2655
  address: string;
@@ -2674,12 +2676,13 @@ declare module "dgram" {
2674
2676
  reuseAddr?: boolean;
2675
2677
  recvBufferSize?: number;
2676
2678
  sendBufferSize?: number;
2679
+ lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void) => void;
2677
2680
  }
2678
2681
 
2679
2682
  export function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
2680
2683
  export function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
2681
2684
 
2682
- export interface Socket extends events.EventEmitter {
2685
+ export class Socket extends events.EventEmitter {
2683
2686
  send(msg: Buffer | String | any[], port: number, address: string, callback?: (error: Error | null, bytes: number) => void): void;
2684
2687
  send(msg: Buffer | String | any[], offset: number, length: number, port: number, address: string, callback?: (error: Error | null, bytes: number) => void): void;
2685
2688
  bind(port?: number, address?: string, callback?: () => void): void;
@@ -2757,7 +2760,7 @@ declare module "fs" {
2757
2760
  */
2758
2761
  export type PathLike = string | Buffer | URL;
2759
2762
 
2760
- export interface Stats {
2763
+ export class Stats {
2761
2764
  isFile(): boolean;
2762
2765
  isDirectory(): boolean;
2763
2766
  isBlockDevice(): boolean;
@@ -2814,7 +2817,7 @@ declare module "fs" {
2814
2817
  prependOnceListener(event: "error", listener: (error: Error) => void): this;
2815
2818
  }
2816
2819
 
2817
- export interface ReadStream extends stream.Readable {
2820
+ export class ReadStream extends stream.Readable {
2818
2821
  close(): void;
2819
2822
  destroy(): void;
2820
2823
  bytesRead: number;
@@ -2846,7 +2849,7 @@ declare module "fs" {
2846
2849
  prependOnceListener(event: "close", listener: () => void): this;
2847
2850
  }
2848
2851
 
2849
- export interface WriteStream extends stream.Writable {
2852
+ export class WriteStream extends stream.Writable {
2850
2853
  close(): void;
2851
2854
  bytesWritten: number;
2852
2855
  path: string | Buffer;
@@ -4179,6 +4182,9 @@ declare module "fs" {
4179
4182
  /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */
4180
4183
  export const O_SYNC: number;
4181
4184
 
4185
+ /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */
4186
+ export const O_DSYNC: number;
4187
+
4182
4188
  /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */
4183
4189
  export const O_SYMLINK: number;
4184
4190
 
@@ -4251,6 +4257,9 @@ declare module "fs" {
4251
4257
 
4252
4258
  /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
4253
4259
  export const S_IXOTH: number;
4260
+
4261
+ /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */
4262
+ export const COPYFILE_EXCL: number;
4254
4263
  }
4255
4264
 
4256
4265
  /**
@@ -4333,6 +4342,54 @@ declare module "fs" {
4333
4342
  * @param fd A file descriptor.
4334
4343
  */
4335
4344
  export function fdatasyncSync(fd: number): void;
4345
+
4346
+ /**
4347
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
4348
+ * No arguments other than a possible exception are given to the callback function.
4349
+ * Node.js makes no guarantees about the atomicity of the copy operation.
4350
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
4351
+ * to remove the destination.
4352
+ * @param src A path to the source file.
4353
+ * @param dest A path to the destination file.
4354
+ */
4355
+ export function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
4356
+ /**
4357
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
4358
+ * No arguments other than a possible exception are given to the callback function.
4359
+ * Node.js makes no guarantees about the atomicity of the copy operation.
4360
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
4361
+ * to remove the destination.
4362
+ * @param src A path to the source file.
4363
+ * @param dest A path to the destination file.
4364
+ * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
4365
+ */
4366
+ export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException) => void): void;
4367
+
4368
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
4369
+ export namespace copyFile {
4370
+ /**
4371
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
4372
+ * No arguments other than a possible exception are given to the callback function.
4373
+ * Node.js makes no guarantees about the atomicity of the copy operation.
4374
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
4375
+ * to remove the destination.
4376
+ * @param src A path to the source file.
4377
+ * @param dest A path to the destination file.
4378
+ * @param flags An optional integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
4379
+ */
4380
+ export function __promisify__(src: PathLike, dst: PathLike, flags?: number): Promise<void>;
4381
+ }
4382
+
4383
+ /**
4384
+ * Synchronously copies src to dest. By default, dest is overwritten if it already exists.
4385
+ * Node.js makes no guarantees about the atomicity of the copy operation.
4386
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
4387
+ * to remove the destination.
4388
+ * @param src A path to the source file.
4389
+ * @param dest A path to the destination file.
4390
+ * @param flags An optional integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
4391
+ */
4392
+ export function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
4336
4393
  }
4337
4394
 
4338
4395
  declare module "path" {
@@ -5084,7 +5141,7 @@ declare module "stream" {
5084
5141
  isPaused(): boolean;
5085
5142
  unpipe<T extends NodeJS.WritableStream>(destination?: T): this;
5086
5143
  unshift(chunk: any): void;
5087
- wrap(oldStream: NodeJS.ReadableStream): Readable;
5144
+ wrap(oldStream: NodeJS.ReadableStream): this;
5088
5145
  push(chunk: any, encoding?: string): boolean;
5089
5146
  _destroy(err: Error, callback: Function): void;
5090
5147
  destroy(error?: Error): void;
@@ -5673,6 +5730,7 @@ declare module "constants" {
5673
5730
  export var O_NOATIME: number;
5674
5731
  export var O_NOFOLLOW: number;
5675
5732
  export var O_SYNC: number;
5733
+ export var O_DSYNC: number;
5676
5734
  export var O_SYMLINK: number;
5677
5735
  export var O_DIRECT: number;
5678
5736
  export var O_NONBLOCK: number;
@@ -6060,6 +6118,10 @@ declare module "http2" {
6060
6118
  length?: number;
6061
6119
  }
6062
6120
 
6121
+ export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
6122
+ onError?: (err: NodeJS.ErrnoException) => void;
6123
+ }
6124
+
6063
6125
  export interface Http2Stream extends stream.Duplex {
6064
6126
  readonly aborted: boolean;
6065
6127
  readonly destroyed: boolean;
@@ -6206,7 +6268,7 @@ declare module "http2" {
6206
6268
  pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (pushStream: ServerHttp2Stream) => void): void;
6207
6269
  respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void;
6208
6270
  respondWithFD(fd: number, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void;
6209
- respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void;
6271
+ respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void;
6210
6272
  }
6211
6273
 
6212
6274
  // Http2Session
@@ -6395,8 +6457,8 @@ declare module "http2" {
6395
6457
  export type ClientSessionOptions = SessionOptions;
6396
6458
  export type ServerSessionOptions = SessionOptions;
6397
6459
 
6398
- export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
6399
- export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {}
6460
+ export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { }
6461
+ export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { }
6400
6462
 
6401
6463
  export interface ServerOptions extends ServerSessionOptions {
6402
6464
  allowHTTP1?: boolean;
@@ -6556,7 +6618,7 @@ declare module "http2" {
6556
6618
  writeContinue(): void;
6557
6619
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders): void;
6558
6620
  writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): void;
6559
- createPushResponse(headers: OutgoingHttpHeaders, callback?: (err: Error) => void): void;
6621
+ createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void;
6560
6622
 
6561
6623
  addListener(event: string, listener: (...args: any[]) => void): this;
6562
6624
  addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "8.0.41",
3
+ "version": "8.0.45",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -75,6 +75,6 @@
75
75
  },
76
76
  "scripts": {},
77
77
  "dependencies": {},
78
- "typesPublisherContentHash": "406b20b2f37de58ca5e2d76b28d5e84eeaa2e78344e5889e4f6013bf26694d2d",
78
+ "typesPublisherContentHash": "d6b75b845bd37b469f6634b03cd731715c97bdd08beda82b470016794c2f2c33",
79
79
  "typeScriptVersion": "2.2"
80
80
  }