mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
[node] Fix linting errors
This commit is contained in:
42
types/node/v4/index.d.ts
vendored
42
types/node/v4/index.d.ts
vendored
@@ -154,8 +154,6 @@ declare var Buffer: {
|
||||
prototype: Buffer;
|
||||
/**
|
||||
* Allocates a new Buffer using an {array} of octets.
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
from(array: any[]): Buffer;
|
||||
/**
|
||||
@@ -165,22 +163,16 @@ declare var Buffer: {
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?:number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
from(buffer: Buffer): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
from(str: string, encoding?: string): Buffer;
|
||||
/**
|
||||
@@ -1589,15 +1581,11 @@ declare module "fs" {
|
||||
|
||||
/**
|
||||
* Asynchronous rename.
|
||||
* @param oldPath
|
||||
* @param newPath
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous rename
|
||||
* @param oldPath
|
||||
* @param newPath
|
||||
*/
|
||||
export function renameSync(oldPath: string, newPath: string): void;
|
||||
export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
@@ -1642,79 +1630,62 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous unlink - deletes the file specified in {path}
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous unlink - deletes the file specified in {path}
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
export function unlinkSync(path: string): void;
|
||||
/**
|
||||
* Asynchronous rmdir - removes the directory specified in {path}
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous rmdir - removes the directory specified in {path}
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
export function rmdirSync(path: string): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdirSync(path: string, mode?: number): void;
|
||||
/**
|
||||
* Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdirSync(path: string, mode?: string): void;
|
||||
/**
|
||||
* Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||
*
|
||||
* @param prefix
|
||||
* @param callback The created folder path is passed as a string to the callback's second parameter.
|
||||
*/
|
||||
export function mkdtemp(prefix: string, callback?: (err: NodeJS.ErrnoException, folder: string) => void): void;
|
||||
/**
|
||||
* Synchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||
*
|
||||
* @param prefix
|
||||
* @returns Returns the created folder path.
|
||||
*/
|
||||
export function mkdtempSync(prefix: string): string;
|
||||
@@ -1749,8 +1720,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param encoding
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
export function readFile(filename: string, encoding: null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
@@ -1759,7 +1728,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
@@ -1769,7 +1737,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
@@ -1777,15 +1744,11 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param encoding
|
||||
*/
|
||||
export function readFileSync(filename: string, encoding: null): Buffer;
|
||||
export function readFileSync(filename: string, encoding: string): string;
|
||||
@@ -1793,7 +1756,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
|
||||
*/
|
||||
export function readFileSync(filename: string, options: { encoding: null; flag?: string; }): Buffer;
|
||||
@@ -1802,7 +1764,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
|
||||
*/
|
||||
export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
|
||||
@@ -1923,9 +1884,6 @@ declare module "path" {
|
||||
/**
|
||||
* Solve the relative path from {from} to {to}.
|
||||
* 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.
|
||||
*
|
||||
* @param from
|
||||
* @param to
|
||||
*/
|
||||
export function relative(from: string, to: string): string;
|
||||
/**
|
||||
|
||||
64
types/node/v6/index.d.ts
vendored
64
types/node/v6/index.d.ts
vendored
@@ -150,8 +150,6 @@ declare var Buffer: {
|
||||
prototype: Buffer;
|
||||
/**
|
||||
* Allocates a new Buffer using an {array} of octets.
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
from(array: any[]): Buffer;
|
||||
/**
|
||||
@@ -161,22 +159,16 @@ declare var Buffer: {
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
from(buffer: Buffer): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
from(str: string, encoding?: string): Buffer;
|
||||
/**
|
||||
@@ -2367,15 +2359,11 @@ declare module "fs" {
|
||||
|
||||
/**
|
||||
* Asynchronous rename.
|
||||
* @param oldPath
|
||||
* @param newPath
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous rename
|
||||
* @param oldPath
|
||||
* @param newPath
|
||||
*/
|
||||
export function renameSync(oldPath: string, newPath: string): void;
|
||||
export function truncate(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
@@ -2420,79 +2408,62 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous unlink - deletes the file specified in {path}
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function unlink(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous unlink - deletes the file specified in {path}
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
export function unlinkSync(path: string | Buffer): void;
|
||||
/**
|
||||
* Asynchronous rmdir - removes the directory specified in {path}
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function rmdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous rmdir - removes the directory specified in {path}
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
export function rmdirSync(path: string | Buffer): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdirSync(path: string | Buffer, mode?: number): void;
|
||||
/**
|
||||
* Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdirSync(path: string | Buffer, mode?: string): void;
|
||||
/**
|
||||
* Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||
*
|
||||
* @param prefix
|
||||
* @param callback The created folder path is passed as a string to the callback's second parameter.
|
||||
*/
|
||||
export function mkdtemp(prefix: string, callback?: (err: NodeJS.ErrnoException, folder: string) => void): void;
|
||||
/**
|
||||
* Synchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||
*
|
||||
* @param prefix
|
||||
* @returns Returns the created folder path.
|
||||
*/
|
||||
export function mkdtempSync(prefix: string): string;
|
||||
@@ -2525,8 +2496,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param encoding
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
export function readFile(filename: string, encoding: null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
@@ -2535,7 +2504,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
@@ -2545,7 +2513,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
@@ -2553,15 +2520,11 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param encoding
|
||||
*/
|
||||
export function readFileSync(filename: string, encoding: null): Buffer;
|
||||
export function readFileSync(filename: string, encoding: string): string;
|
||||
@@ -2569,7 +2532,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
|
||||
*/
|
||||
export function readFileSync(filename: string, options: { encoding: null; flag?: string; }): Buffer;
|
||||
@@ -2578,7 +2540,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
|
||||
*/
|
||||
export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
|
||||
@@ -2819,9 +2780,6 @@ declare module "path" {
|
||||
/**
|
||||
* Solve the relative path from {from} to {to}.
|
||||
* 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.
|
||||
*
|
||||
* @param from
|
||||
* @param to
|
||||
*/
|
||||
export function relative(from: string, to: string): string;
|
||||
/**
|
||||
@@ -3020,7 +2978,7 @@ declare module "tls" {
|
||||
/**
|
||||
* Returns the bound address, the address family name and port of the underlying socket as reported by
|
||||
* the operating system.
|
||||
* @returns {any} - An object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' }.
|
||||
* @returns An object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' }.
|
||||
*/
|
||||
address(): { port: number; family: string; address: string };
|
||||
/**
|
||||
@@ -3039,8 +2997,8 @@ declare module "tls" {
|
||||
encrypted: boolean;
|
||||
/**
|
||||
* Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
|
||||
* @returns {CipherNameAndProtocol} - Returns an object representing the cipher name
|
||||
* and the SSL/TLS protocol version of the current connection.
|
||||
* @returns Returns an object representing the cipher name and the SSL/TLS protocol version of the current
|
||||
* connection.
|
||||
*/
|
||||
getCipher(): CipherNameAndProtocol;
|
||||
/**
|
||||
@@ -3049,8 +3007,8 @@ declare module "tls" {
|
||||
* If detailed argument is true the full chain with issuer property will be returned,
|
||||
* if false only the top certificate without issuer property.
|
||||
* If the peer does not provide a certificate, it returns null or an empty object.
|
||||
* @param {boolean} detailed - If true; the full chain with issuer property will be returned.
|
||||
* @returns {any} - An object representing the peer's certificate.
|
||||
* @param detailed - If true; the full chain with issuer property will be returned.
|
||||
* @returns An object representing the peer's certificate.
|
||||
*/
|
||||
getPeerCertificate(detailed?: boolean): {
|
||||
subject: Certificate;
|
||||
@@ -3064,13 +3022,13 @@ declare module "tls" {
|
||||
};
|
||||
/**
|
||||
* Could be used to speed up handshake establishment when reconnecting to the server.
|
||||
* @returns {any} - ASN.1 encoded TLS session or undefined if none was negotiated.
|
||||
* @returns ASN.1 encoded TLS session or undefined if none was negotiated.
|
||||
*/
|
||||
getSession(): any;
|
||||
/**
|
||||
* NOTE: Works only with client TLS sockets.
|
||||
* Useful only for debugging, for session reuse provide session option to tls.connect().
|
||||
* @returns {any} - TLS session ticket or undefined if none was negotiated.
|
||||
* @returns TLS session ticket or undefined if none was negotiated.
|
||||
*/
|
||||
getTLSTicket(): any;
|
||||
/**
|
||||
@@ -3099,9 +3057,9 @@ declare module "tls" {
|
||||
*
|
||||
* NOTE: Can be used to request peer's certificate after the secure connection has been established.
|
||||
* ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
|
||||
* @param {TlsOptions} options - The options may contain the following fields: rejectUnauthorized,
|
||||
* @param options - The options may contain the following fields: rejectUnauthorized,
|
||||
* requestCert (See tls.createServer() for details).
|
||||
* @param {Function} callback - callback(err) will be executed with null as err, once the renegotiation
|
||||
* @param callback - callback(err) will be executed with null as err, once the renegotiation
|
||||
* is successfully completed.
|
||||
*/
|
||||
renegotiate(options: TlsOptions, callback: (err: Error) => any): any;
|
||||
@@ -3112,8 +3070,8 @@ declare module "tls" {
|
||||
* large fragments can span multiple roundtrips, and their processing can be delayed due to packet
|
||||
* loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead,
|
||||
* which may decrease overall server throughput.
|
||||
* @param {number} size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
|
||||
* @returns {boolean} - Returns true on success, false otherwise.
|
||||
* @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
|
||||
* @returns Returns true on success, false otherwise.
|
||||
*/
|
||||
setMaxSendFragment(size: number): boolean;
|
||||
|
||||
|
||||
60
types/node/v7/index.d.ts
vendored
60
types/node/v7/index.d.ts
vendored
@@ -166,8 +166,6 @@ declare var Buffer: {
|
||||
prototype: Buffer;
|
||||
/**
|
||||
* Allocates a new Buffer using an {array} of octets.
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
from(array: any[]): Buffer;
|
||||
/**
|
||||
@@ -177,22 +175,16 @@ declare var Buffer: {
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
from(buffer: Buffer): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
from(str: string, encoding?: string): Buffer;
|
||||
/**
|
||||
@@ -2500,15 +2492,11 @@ declare module "fs" {
|
||||
|
||||
/**
|
||||
* Asynchronous rename.
|
||||
* @param oldPath
|
||||
* @param newPath
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous rename
|
||||
* @param oldPath
|
||||
* @param newPath
|
||||
*/
|
||||
export function renameSync(oldPath: string, newPath: string): void;
|
||||
export function truncate(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
@@ -2553,79 +2541,62 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous unlink - deletes the file specified in {path}
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function unlink(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous unlink - deletes the file specified in {path}
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
export function unlinkSync(path: string | Buffer): void;
|
||||
/**
|
||||
* Asynchronous rmdir - removes the directory specified in {path}
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function rmdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous rmdir - removes the directory specified in {path}
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
export function rmdirSync(path: string | Buffer): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdir(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
/**
|
||||
* Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdirSync(path: string | Buffer, mode?: number): void;
|
||||
/**
|
||||
* Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||
*
|
||||
* @param path
|
||||
* @param mode
|
||||
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||
*/
|
||||
export function mkdirSync(path: string | Buffer, mode?: string): void;
|
||||
/**
|
||||
* Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||
*
|
||||
* @param prefix
|
||||
* @param callback The created folder path is passed as a string to the callback's second parameter.
|
||||
*/
|
||||
export function mkdtemp(prefix: string, callback?: (err: NodeJS.ErrnoException, folder: string) => void): void;
|
||||
/**
|
||||
* Synchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||
*
|
||||
* @param prefix
|
||||
* @returns Returns the created folder path.
|
||||
*/
|
||||
export function mkdtempSync(prefix: string): string;
|
||||
@@ -2659,8 +2630,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param encoding
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
export function readFile(filename: string, encoding: null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
@@ -2669,7 +2638,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
@@ -2679,7 +2647,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
@@ -2687,15 +2654,11 @@ declare module "fs" {
|
||||
/**
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
|
||||
*/
|
||||
export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param encoding
|
||||
*/
|
||||
export function readFileSync(filename: string, encoding: null): Buffer;
|
||||
export function readFileSync(filename: string, encoding: string): string;
|
||||
@@ -2703,7 +2666,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
|
||||
*/
|
||||
export function readFileSync(filename: string, options: { encoding: null; flag?: string; }): Buffer;
|
||||
@@ -2712,7 +2674,6 @@ declare module "fs" {
|
||||
/**
|
||||
* Synchronous readFile - Synchronously reads the entire contents of a file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
|
||||
*/
|
||||
export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
|
||||
@@ -2953,9 +2914,6 @@ declare module "path" {
|
||||
/**
|
||||
* Solve the relative path from {from} to {to}.
|
||||
* 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.
|
||||
*
|
||||
* @param from
|
||||
* @param to
|
||||
*/
|
||||
export function relative(from: string, to: string): string;
|
||||
/**
|
||||
@@ -3173,7 +3131,7 @@ declare module "tls" {
|
||||
/**
|
||||
* Returns the bound address, the address family name and port of the underlying socket as reported by
|
||||
* the operating system.
|
||||
* @returns {any} - An object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' }.
|
||||
* @returns An object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' }.
|
||||
*/
|
||||
address(): { port: number; family: string; address: string };
|
||||
/**
|
||||
@@ -3192,7 +3150,7 @@ declare module "tls" {
|
||||
encrypted: boolean;
|
||||
/**
|
||||
* Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
|
||||
* @returns {CipherNameAndProtocol} - Returns an object representing the cipher name
|
||||
* @returns Returns an object representing the cipher name
|
||||
* and the SSL/TLS protocol version of the current connection.
|
||||
*/
|
||||
getCipher(): CipherNameAndProtocol;
|
||||
@@ -3202,15 +3160,15 @@ declare module "tls" {
|
||||
* If detailed argument is true the full chain with issuer property will be returned,
|
||||
* if false only the top certificate without issuer property.
|
||||
* If the peer does not provide a certificate, it returns null or an empty object.
|
||||
* @param {boolean} detailed - If true; the full chain with issuer property will be returned.
|
||||
* @returns {PeerCertificate | DetailedPeerCertificate} - An object representing the peer's certificate.
|
||||
* @param detailed - If true; the full chain with issuer property will be returned.
|
||||
* @returns An object representing the peer's certificate.
|
||||
*/
|
||||
getPeerCertificate(detailed: true): DetailedPeerCertificate;
|
||||
getPeerCertificate(detailed?: false): PeerCertificate;
|
||||
getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
|
||||
/**
|
||||
* Could be used to speed up handshake establishment when reconnecting to the server.
|
||||
* @returns {any} - ASN.1 encoded TLS session or undefined if none was negotiated.
|
||||
* @returns ASN.1 encoded TLS session or undefined if none was negotiated.
|
||||
*/
|
||||
getSession(): any;
|
||||
/**
|
||||
@@ -3245,9 +3203,9 @@ declare module "tls" {
|
||||
*
|
||||
* NOTE: Can be used to request peer's certificate after the secure connection has been established.
|
||||
* ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
|
||||
* @param {TlsOptions} options - The options may contain the following fields: rejectUnauthorized,
|
||||
* @param options - The options may contain the following fields: rejectUnauthorized,
|
||||
* requestCert (See tls.createServer() for details).
|
||||
* @param {Function} callback - callback(err) will be executed with null as err, once the renegotiation
|
||||
* @param callback - callback(err) will be executed with null as err, once the renegotiation
|
||||
* is successfully completed.
|
||||
*/
|
||||
renegotiate(options: TlsOptions, callback: (err: Error) => any): any;
|
||||
@@ -3258,8 +3216,8 @@ declare module "tls" {
|
||||
* large fragments can span multiple roundtrips, and their processing can be delayed due to packet
|
||||
* loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead,
|
||||
* which may decrease overall server throughput.
|
||||
* @param {number} size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
|
||||
* @returns {boolean} - Returns true on success, false otherwise.
|
||||
* @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
|
||||
* @returns Returns true on success, false otherwise.
|
||||
*/
|
||||
setMaxSendFragment(size: number): boolean;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user