mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge remote-tracking branch 'upstream/master' into merge_7_25
This commit is contained in:
219
node/index.d.ts
vendored
219
node/index.d.ts
vendored
@@ -31,10 +31,10 @@ interface ErrorConstructor {
|
||||
// compat for TypeScript 1.8
|
||||
// if you use with --target es3 or --target es5 and use below definitions,
|
||||
// use the lib.es6.d.ts that is bundled with TypeScript 1.8.
|
||||
interface MapConstructor {}
|
||||
interface WeakMapConstructor {}
|
||||
interface SetConstructor {}
|
||||
interface WeakSetConstructor {}
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
interface WeakSetConstructor { }
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
@@ -60,7 +60,7 @@ interface NodeRequireFunction {
|
||||
}
|
||||
|
||||
interface NodeRequire extends NodeRequireFunction {
|
||||
resolve(id:string): string;
|
||||
resolve(id: string): string;
|
||||
cache: any;
|
||||
extensions: any;
|
||||
main: any;
|
||||
@@ -96,7 +96,7 @@ declare var SlowBuffer: {
|
||||
|
||||
// Buffer class
|
||||
type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "binary" | "hex";
|
||||
interface Buffer extends NodeBuffer {}
|
||||
interface Buffer extends NodeBuffer { }
|
||||
|
||||
/**
|
||||
* Raw data is stored in instances of the Buffer class.
|
||||
@@ -160,7 +160,7 @@ declare var Buffer: {
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?:number): Buffer;
|
||||
from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
@@ -220,7 +220,7 @@ declare var Buffer: {
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initalizing
|
||||
*/
|
||||
alloc(size: number, fill?: string|Buffer|number, encoding?: string): Buffer;
|
||||
alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
@@ -271,7 +271,7 @@ declare namespace NodeJS {
|
||||
|
||||
export interface ReadableStream extends EventEmitter {
|
||||
readable: boolean;
|
||||
read(size?: number): string|Buffer;
|
||||
read(size?: number): string | Buffer;
|
||||
setEncoding(encoding: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
@@ -284,7 +284,7 @@ declare namespace NodeJS {
|
||||
|
||||
export interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Buffer|string, cb?: Function): boolean;
|
||||
write(buffer: Buffer | string, cb?: Function): boolean;
|
||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||
end(): void;
|
||||
end(buffer: Buffer, cb?: Function): void;
|
||||
@@ -292,7 +292,7 @@ declare namespace NodeJS {
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream {}
|
||||
export interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
export interface Events extends EventEmitter { }
|
||||
|
||||
@@ -372,7 +372,7 @@ declare namespace NodeJS {
|
||||
visibility: string;
|
||||
};
|
||||
};
|
||||
kill(pid:number, signal?: string|number): void;
|
||||
kill(pid: number, signal?: string | number): void;
|
||||
pid: number;
|
||||
title: string;
|
||||
arch: string;
|
||||
@@ -381,7 +381,7 @@ declare namespace NodeJS {
|
||||
nextTick(callback: Function): void;
|
||||
umask(mask?: number): number;
|
||||
uptime(): number;
|
||||
hrtime(time?:number[]): number[];
|
||||
hrtime(time?: number[]): number[];
|
||||
domain: Domain;
|
||||
|
||||
// Worker
|
||||
@@ -457,8 +457,8 @@ declare namespace NodeJS {
|
||||
}
|
||||
|
||||
export interface Timer {
|
||||
ref() : void;
|
||||
unref() : void;
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ declare module "http" {
|
||||
path?: string;
|
||||
headers?: { [key: string]: any };
|
||||
auth?: string;
|
||||
agent?: Agent|boolean;
|
||||
agent?: Agent | boolean;
|
||||
}
|
||||
|
||||
export interface Server extends events.EventEmitter, net.Server {
|
||||
@@ -619,6 +619,7 @@ declare module "http" {
|
||||
statusMessage: string;
|
||||
headersSent: boolean;
|
||||
setHeader(name: string, value: string | string[]): void;
|
||||
setTimeout(msecs: number, callback: Function): ServerResponse;
|
||||
sendDate: boolean;
|
||||
getHeader(name: string): string;
|
||||
removeHeader(name: string): void;
|
||||
@@ -730,7 +731,7 @@ declare module "http" {
|
||||
[errorCode: number]: string;
|
||||
[errorCode: string]: string;
|
||||
};
|
||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
|
||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) => void): Server;
|
||||
export function createClient(port?: number, host?: string): any;
|
||||
export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
@@ -814,19 +815,19 @@ declare module "zlib" {
|
||||
export function createInflateRaw(options?: ZlibOptions): InflateRaw;
|
||||
export function createUnzip(options?: ZlibOptions): Unzip;
|
||||
|
||||
export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function deflate(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function deflateSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function gzip(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function gzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function gunzip(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function gunzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function inflate(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function inflateSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function unzip(buf: Buffer, callback: (error: Error, result: any) => void): void;
|
||||
export function unzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
|
||||
// Constants
|
||||
@@ -897,7 +898,7 @@ declare module "os" {
|
||||
export function totalmem(): number;
|
||||
export function freemem(): number;
|
||||
export function cpus(): CpuInfo[];
|
||||
export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]};
|
||||
export function networkInterfaces(): { [index: string]: NetworkInterfaceInfo[] };
|
||||
export var EOL: string;
|
||||
}
|
||||
|
||||
@@ -943,8 +944,8 @@ declare module "https" {
|
||||
};
|
||||
export interface Server extends tls.Server { }
|
||||
export function createServer(options: ServerOptions, requestListener?: Function): Server;
|
||||
export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
||||
export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
@@ -998,7 +999,7 @@ declare module "readline" {
|
||||
pause(): ReadLine;
|
||||
resume(): ReadLine;
|
||||
close(): void;
|
||||
write(data: string|Buffer, key?: Key): void;
|
||||
write(data: string | Buffer, key?: Key): void;
|
||||
}
|
||||
|
||||
export interface Completer {
|
||||
@@ -1023,7 +1024,7 @@ declare module "readline" {
|
||||
export function createInterface(options: ReadLineOptions): ReadLine;
|
||||
|
||||
export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void;
|
||||
export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void;
|
||||
export function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void;
|
||||
export function clearLine(stream: NodeJS.WritableStream, dir: number): void;
|
||||
export function clearScreenDown(stream: NodeJS.WritableStream): void;
|
||||
}
|
||||
@@ -1075,6 +1076,7 @@ declare module "child_process" {
|
||||
connected: boolean;
|
||||
disconnect(): void;
|
||||
unref(): void;
|
||||
ref(): void;
|
||||
}
|
||||
|
||||
export interface SpawnOptions {
|
||||
@@ -1104,11 +1106,11 @@ declare module "child_process" {
|
||||
export interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function exec(command: string, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
// usage. child_process.exec("tsc", {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function exec(command: string, options: ExecOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptions, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
export interface ExecFileOptions {
|
||||
cwd?: string;
|
||||
@@ -1125,16 +1127,16 @@ declare module "child_process" {
|
||||
export interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function execFile(file: string, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
// usage. child_process.execFile("file.sh", {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
// usage. child_process.execFile("file.sh", ["foo"], {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
export interface ForkOptions {
|
||||
cwd?: string;
|
||||
@@ -1250,24 +1252,24 @@ declare module "url" {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
||||
export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url;
|
||||
export function format(url: Url): string;
|
||||
export function resolve(from: string, to: string): string;
|
||||
}
|
||||
|
||||
declare module "dns" {
|
||||
export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string;
|
||||
export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string;
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[];
|
||||
export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) => void): string;
|
||||
export function lookup(domain: string, callback: (err: Error, address: string, family: number) => void): string;
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
|
||||
}
|
||||
|
||||
declare module "net" {
|
||||
@@ -1342,12 +1344,12 @@ declare module "net" {
|
||||
maxConnections: number;
|
||||
connections: number;
|
||||
}
|
||||
export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
|
||||
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
|
||||
export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function createServer(connectionListener?: (socket: Socket) => void): Server;
|
||||
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) => void): Server;
|
||||
export function connect(options: { port: number, host?: string, localAddress?: string, localPort?: string, family?: number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
||||
export function connect(path: string, connectionListener?: Function): Socket;
|
||||
export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function createConnection(options: { port: number, host?: string, localAddress?: string, localPort?: string, family?: number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||
export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
||||
export function createConnection(path: string, connectionListener?: Function): Socket;
|
||||
export function isIP(input: string): number;
|
||||
@@ -1476,7 +1478,7 @@ declare module "fs" {
|
||||
export function readlink(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||
export function readlinkSync(path: string | Buffer): string;
|
||||
export function realpath(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string | Buffer, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpathSync(path: string | Buffer, cache?: { [path: string]: string }): string;
|
||||
/*
|
||||
* Asynchronous unlink - deletes the file specified in {path}
|
||||
@@ -1561,11 +1563,9 @@ declare module "fs" {
|
||||
export function readdirSync(path: string | Buffer): string[];
|
||||
export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function closeSync(fd: number): void;
|
||||
export function open(path: string | Buffer, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
||||
export function open(path: string | Buffer, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
||||
export function open(path: string | Buffer, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
|
||||
export function openSync(path: string | Buffer, flags: string, mode?: number): number;
|
||||
export function openSync(path: string | Buffer, flags: string, mode?: string): number;
|
||||
export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
|
||||
export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
|
||||
export function openSync(path: string | Buffer, flags: string | number, mode?: number): number;
|
||||
export function utimes(path: string | Buffer, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
|
||||
export function utimesSync(path: string | Buffer, atime: number, mtime: number): void;
|
||||
@@ -1651,8 +1651,8 @@ declare module "fs" {
|
||||
export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
|
||||
export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
|
||||
export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, encoding: string, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string) => any): FSWatcher;
|
||||
export function watch(filename: string, encoding: string, listener?: (event: string, filename: string | Buffer) => any): FSWatcher;
|
||||
export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string | Buffer) => any): FSWatcher;
|
||||
export function exists(path: string | Buffer, callback?: (exists: boolean) => void): void;
|
||||
export function existsSync(path: string | Buffer): boolean;
|
||||
/** Constant for fs.access(). File is visible to the calling process. */
|
||||
@@ -1667,7 +1667,7 @@ declare module "fs" {
|
||||
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
/** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */
|
||||
export function accessSync(path: string | Buffer, mode ?: number): void;
|
||||
export function accessSync(path: string | Buffer, mode?: number): void;
|
||||
export function createReadStream(path: string | Buffer, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
@@ -1834,10 +1834,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(buffer?: Buffer): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2069,10 +2069,10 @@ declare module "tls" {
|
||||
context: any;
|
||||
}
|
||||
|
||||
export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server;
|
||||
export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream;
|
||||
export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
||||
export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
|
||||
export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) => void): Server;
|
||||
export function connect(options: TlsOptions, secureConnectionListener?: () => void): ClearTextStream;
|
||||
export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream;
|
||||
export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream;
|
||||
export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
|
||||
export function createSecureContext(details: SecureContextOptions): SecureContext;
|
||||
}
|
||||
@@ -2108,9 +2108,9 @@ declare module "crypto" {
|
||||
export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
||||
export interface Cipher extends NodeJS.ReadWriteStream {
|
||||
update(data: Buffer): Buffer;
|
||||
update(data: string, input_encoding: "utf8"|"ascii"|"binary"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "binary"|"base64"|"hex"): string;
|
||||
update(data: string, input_encoding: "utf8"|"ascii"|"binary", output_encoding: "binary"|"base64"|"hex"): string;
|
||||
update(data: string, input_encoding: "utf8" | "ascii" | "binary"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "binary" | "base64" | "hex"): string;
|
||||
update(data: string, input_encoding: "utf8" | "ascii" | "binary", output_encoding: "binary" | "base64" | "hex"): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
@@ -2120,9 +2120,9 @@ declare module "crypto" {
|
||||
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
||||
export interface Decipher extends NodeJS.ReadWriteStream {
|
||||
update(data: Buffer): Buffer;
|
||||
update(data: string, input_encoding: "binary"|"base64"|"hex"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "utf8"|"ascii"|"binary"): string;
|
||||
update(data: string, input_encoding: "binary"|"base64"|"hex", output_encoding: "utf8"|"ascii"|"binary"): string;
|
||||
update(data: string, input_encoding: "binary" | "base64" | "hex"): Buffer;
|
||||
update(data: Buffer, input_encoding: any, output_encoding: "utf8" | "ascii" | "binary"): string;
|
||||
update(data: string, input_encoding: "binary" | "base64" | "hex", output_encoding: "utf8" | "ascii" | "binary"): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
@@ -2151,14 +2151,14 @@ declare module "crypto" {
|
||||
setPrivateKey(public_key: string, encoding?: string): void;
|
||||
}
|
||||
export function getDiffieHellman(group_name: string): DiffieHellman;
|
||||
export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer;
|
||||
export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer;
|
||||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number): Buffer;
|
||||
export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string): Buffer;
|
||||
export function randomBytes(size: number): Buffer;
|
||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function pseudoRandomBytes(size: number): Buffer;
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export interface RsaPublicKey {
|
||||
key: string;
|
||||
padding?: any;
|
||||
@@ -2168,8 +2168,8 @@ declare module "crypto" {
|
||||
passphrase?: string,
|
||||
padding?: any;
|
||||
}
|
||||
export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer
|
||||
export function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer
|
||||
}
|
||||
|
||||
declare module "stream" {
|
||||
@@ -2183,6 +2183,7 @@ declare module "stream" {
|
||||
highWaterMark?: number;
|
||||
encoding?: string;
|
||||
objectMode?: boolean;
|
||||
read?: (size?: number) => any;
|
||||
}
|
||||
|
||||
export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
|
||||
@@ -2204,6 +2205,8 @@ declare module "stream" {
|
||||
highWaterMark?: number;
|
||||
decodeStrings?: boolean;
|
||||
objectMode?: boolean;
|
||||
write?: (chunk: string|Buffer, encoding: string, callback: Function) => any;
|
||||
writev?: (chunks: {chunk: string|Buffer, encoding: string}[], callback: Function) => any;
|
||||
}
|
||||
|
||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||
@@ -2219,6 +2222,8 @@ declare module "stream" {
|
||||
|
||||
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writableObjectMode?: boolean;
|
||||
}
|
||||
|
||||
// Note: Duplex extends both Readable and Writable.
|
||||
@@ -2233,7 +2238,10 @@ declare module "stream" {
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export interface TransformOptions extends ReadableOptions, WritableOptions {}
|
||||
export interface TransformOptions extends ReadableOptions, WritableOptions {
|
||||
transform?: (chunk: string|Buffer, encoding: string, callback: Function) => any;
|
||||
flush?: (callback: Function) => any;
|
||||
}
|
||||
|
||||
// Note: Transform lacks the _read and _write methods of Readable/Writable.
|
||||
export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
|
||||
@@ -2258,7 +2266,7 @@ declare module "stream" {
|
||||
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||
}
|
||||
|
||||
export class PassThrough extends Transform {}
|
||||
export class PassThrough extends Transform { }
|
||||
}
|
||||
|
||||
declare module "util" {
|
||||
@@ -2282,11 +2290,11 @@ declare module "util" {
|
||||
export function isDate(object: any): boolean;
|
||||
export function isError(object: any): boolean;
|
||||
export function inherits(constructor: any, superConstructor: any): void;
|
||||
export function debuglog(key:string): (msg:string,...param: any[])=>void;
|
||||
export function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
||||
}
|
||||
|
||||
declare module "assert" {
|
||||
function internal (value: any, message?: string): void;
|
||||
function internal(value: any, message?: string): void;
|
||||
namespace internal {
|
||||
export class AssertionError implements Error {
|
||||
name: string;
|
||||
@@ -2296,8 +2304,10 @@ declare module "assert" {
|
||||
operator: string;
|
||||
generatedMessage: boolean;
|
||||
|
||||
constructor(options?: {message?: string; actual?: any; expected?: any;
|
||||
operator?: string; stackStartFunction?: Function});
|
||||
constructor(options?: {
|
||||
message?: string; actual?: any; expected?: any;
|
||||
operator?: string; stackStartFunction?: Function
|
||||
});
|
||||
}
|
||||
|
||||
export function fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
||||
@@ -2573,9 +2583,32 @@ declare module "constants" {
|
||||
export var S_IFREG: number;
|
||||
export var S_IFDIR: number;
|
||||
export var S_IFCHR: number;
|
||||
export var S_IFBLK: number;
|
||||
export var S_IFIFO: number;
|
||||
export var S_IFSOCK: number;
|
||||
export var S_IRWXU: number;
|
||||
export var S_IRUSR: number;
|
||||
export var S_IWUSR: number;
|
||||
export var S_IXUSR: number;
|
||||
export var S_IRWXG: number;
|
||||
export var S_IRGRP: number;
|
||||
export var S_IWGRP: number;
|
||||
export var S_IXGRP: number;
|
||||
export var S_IRWXO: number;
|
||||
export var S_IROTH: number;
|
||||
export var S_IWOTH: number;
|
||||
export var S_IXOTH: number;
|
||||
export var S_IFLNK: number;
|
||||
export var O_CREAT: number;
|
||||
export var O_EXCL: number;
|
||||
export var O_NOCTTY: number;
|
||||
export var O_DIRECTORY: number;
|
||||
export var O_NOATIME: number;
|
||||
export var O_NOFOLLOW: number;
|
||||
export var O_SYNC: number;
|
||||
export var O_SYMLINK: number;
|
||||
export var O_DIRECT: number;
|
||||
export var O_NONBLOCK: number;
|
||||
export var O_TRUNC: number;
|
||||
export var O_APPEND: number;
|
||||
export var F_OK: number;
|
||||
|
||||
6
node/node-0.10.d.ts
vendored
6
node/node-0.10.d.ts
vendored
@@ -972,7 +972,7 @@ declare module "fs" {
|
||||
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
||||
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number): number;
|
||||
export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
@@ -1032,10 +1032,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net = require("net");
|
||||
import dgram = require("dgram");
|
||||
import querystring = require('querystring');
|
||||
import readline = require('readline');
|
||||
import string_decoder = require('string_decoder');
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -122,6 +123,18 @@ namespace http_tests {
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
var StringDecoder = string_decoder.StringDecoder;
|
||||
var buffer = new Buffer('test');
|
||||
var decoder = new StringDecoder('utf8');
|
||||
var part: string = decoder.write(new Buffer('test'));
|
||||
var end: string = decoder.end();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Dgram tests : http://nodejs.org/api/dgram.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
6
node/node-0.11.d.ts
vendored
6
node/node-0.11.d.ts
vendored
@@ -883,7 +883,7 @@ declare module "fs" {
|
||||
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
||||
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number): number;
|
||||
export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
@@ -943,10 +943,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import * as querystring from "querystring";
|
||||
import * as path from "path";
|
||||
import * as readline from "readline";
|
||||
import * as childProcess from "child_process";
|
||||
import * as string_decoder from "string_decoder";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -404,6 +405,18 @@ rl.question("do you like typescript?", function(answer: string) {
|
||||
rl.close();
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
var StringDecoder = string_decoder.StringDecoder;
|
||||
var buffer = new Buffer('test');
|
||||
var decoder = new StringDecoder('utf8');
|
||||
var part: string = decoder.write(new Buffer('test'));
|
||||
var end: string = decoder.end();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
6
node/node-0.12.d.ts
vendored
6
node/node-0.12.d.ts
vendored
@@ -1233,7 +1233,7 @@ declare module "fs" {
|
||||
export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
||||
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number): number;
|
||||
/*
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
@@ -1480,10 +1480,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
2
node/node-0.8.8.d.ts
vendored
2
node/node-0.8.8.d.ts
vendored
@@ -772,7 +772,7 @@ declare module "fs" {
|
||||
export function write(fd: string, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: Buffer) =>any): void;
|
||||
export function writeSync(fd: string, buffer: Buffer, offset: number, length: number, position: number): void;
|
||||
export function read(fd: string, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: Buffer) => void): void;
|
||||
export function readSync(fd: string, buffer: Buffer, offset: number, length: number, position: number): any[];
|
||||
export function readSync(fd: string, buffer: Buffer, offset: number, length: number, position?: number): any[];
|
||||
export function readFile(filename: string, encoding: string, callback: (err: ErrnoException, data: string) => void ): void;
|
||||
export function readFile(filename: string, callback: (err: ErrnoException, data: Buffer) => void ): void;
|
||||
export function readFileSync(filename: string): Buffer;
|
||||
|
||||
@@ -19,6 +19,8 @@ import * as childProcess from "child_process";
|
||||
import * as cluster from "cluster";
|
||||
import * as os from "os";
|
||||
import * as vm from "vm";
|
||||
import * as string_decoder from "string_decoder";
|
||||
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
@@ -699,6 +701,18 @@ namespace readline_tests {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
const StringDecoder = string_decoder.StringDecoder;
|
||||
const buffer = new Buffer('test');
|
||||
const decoder = new StringDecoder('utf8');
|
||||
const part: string = decoder.write(new Buffer('test'));
|
||||
const end: string = decoder.end();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
6
node/node-4.d.ts
vendored
6
node/node-4.d.ts
vendored
@@ -1532,7 +1532,7 @@ declare module "fs" {
|
||||
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number): number;
|
||||
export function writeSync(fd: number, data: any, position?: number, enconding?: string): number;
|
||||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number): number;
|
||||
/*
|
||||
* Asynchronous readFile - Asynchronously reads the entire contents of a file.
|
||||
*
|
||||
@@ -1779,10 +1779,10 @@ declare module "path" {
|
||||
declare module "string_decoder" {
|
||||
export interface NodeStringDecoder {
|
||||
write(buffer: Buffer): string;
|
||||
detectIncompleteChar(buffer: Buffer): number;
|
||||
end(): string;
|
||||
}
|
||||
export var StringDecoder: {
|
||||
new (encoding: string): NodeStringDecoder;
|
||||
new (encoding?: string): NodeStringDecoder;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import * as assert from "assert";
|
||||
import * as fs from "fs";
|
||||
import * as events from "events";
|
||||
@@ -20,6 +19,9 @@ import * as cluster from "cluster";
|
||||
import * as os from "os";
|
||||
import * as vm from "vm";
|
||||
import * as console2 from "console";
|
||||
import * as string_decoder from "string_decoder";
|
||||
import * as stream from "stream";
|
||||
|
||||
// Specifically test buffer module regression.
|
||||
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
|
||||
|
||||
@@ -289,6 +291,70 @@ function stream_readable_pipe_test() {
|
||||
r.close();
|
||||
}
|
||||
|
||||
// Simplified constructors
|
||||
function simplified_stream_ctor_test() {
|
||||
new stream.Readable({
|
||||
read: function (size) {
|
||||
size.toFixed();
|
||||
}
|
||||
});
|
||||
|
||||
new stream.Writable({
|
||||
write: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb()
|
||||
},
|
||||
writev: function (chunks, cb) {
|
||||
chunks[0].chunk.slice(0);
|
||||
chunks[0].encoding.charAt(0);
|
||||
cb();
|
||||
}
|
||||
});
|
||||
|
||||
new stream.Duplex({
|
||||
read: function (size) {
|
||||
size.toFixed();
|
||||
},
|
||||
write: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb()
|
||||
},
|
||||
writev: function (chunks, cb) {
|
||||
chunks[0].chunk.slice(0);
|
||||
chunks[0].encoding.charAt(0);
|
||||
cb();
|
||||
},
|
||||
readableObjectMode: true,
|
||||
writableObjectMode: true
|
||||
});
|
||||
|
||||
new stream.Transform({
|
||||
transform: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb();
|
||||
},
|
||||
flush: function (cb) {
|
||||
cb()
|
||||
},
|
||||
read: function (size) {
|
||||
size.toFixed();
|
||||
},
|
||||
write: function (chunk, enc, cb) {
|
||||
chunk.slice(1);
|
||||
enc.charAt(0);
|
||||
cb()
|
||||
},
|
||||
writev: function (chunks, cb) {
|
||||
chunks[0].chunk.slice(0);
|
||||
chunks[0].encoding.charAt(0);
|
||||
cb();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Crypto tests : http://nodejs.org/api/crypto.html
|
||||
////////////////////////////////////////////////////
|
||||
@@ -724,6 +790,21 @@ namespace readline_tests {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// string_decoder tests : https://nodejs.org/api/string_decoder.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
namespace string_decoder_tests {
|
||||
const StringDecoder = string_decoder.StringDecoder;
|
||||
const buffer = new Buffer('test');
|
||||
const decoder1 = new StringDecoder();
|
||||
const decoder2 = new StringDecoder('utf8');
|
||||
const part1: string = decoder1.write(new Buffer('test'));
|
||||
const end1: string = decoder1.end();
|
||||
const part2: string = decoder2.write(new Buffer('test'));
|
||||
const end2: string = decoder1.end(new Buffer('test'));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Child Process tests: https://nodejs.org/api/child_process.html ///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user