mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Merge commit 'upstream/master~550' into merge_7_25
This commit is contained in:
29
node/index.d.ts
vendored
29
node/index.d.ts
vendored
@@ -207,6 +207,29 @@ declare var Buffer: {
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
compare(buf1: Buffer, buf2: Buffer): number;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
||||
* 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;
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
allocUnsafeSlow(size: number): Buffer;
|
||||
};
|
||||
|
||||
/************************************************
|
||||
@@ -315,6 +338,7 @@ declare namespace NodeJS {
|
||||
ares: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
modules: string;
|
||||
openssl: string;
|
||||
};
|
||||
config: {
|
||||
@@ -1618,7 +1642,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, options: { persistent?: boolean; }, 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 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. */
|
||||
@@ -1640,6 +1665,8 @@ declare module "fs" {
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
autoClose?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
}): ReadStream;
|
||||
export function createWriteStream(path: string | Buffer, options?: {
|
||||
flags?: string;
|
||||
|
||||
1
node/node-0.12.d.ts
vendored
1
node/node-0.12.d.ts
vendored
@@ -228,6 +228,7 @@ declare namespace NodeJS {
|
||||
ares: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
modules: string;
|
||||
openssl: string;
|
||||
};
|
||||
config: {
|
||||
|
||||
1
node/node-4.d.ts
vendored
1
node/node-4.d.ts
vendored
@@ -300,6 +300,7 @@ declare namespace NodeJS {
|
||||
ares: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
modules: string;
|
||||
openssl: string;
|
||||
};
|
||||
config: {
|
||||
|
||||
@@ -139,6 +139,22 @@ fs.mkdtemp('/tmp/foo-', (err, folder) => {
|
||||
var tempDir: string;
|
||||
tempDir = fs.mkdtempSync('/tmp/foo-');
|
||||
|
||||
fs.watch('/tmp/foo-', (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
fs.watch('/tmp/foo-', 'utf8', (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
fs.watch('/tmp/foo-', {
|
||||
recursive: true,
|
||||
persistent: true,
|
||||
encoding: 'utf8'
|
||||
}, (event, filename) => {
|
||||
console.log(event, filename);
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
/// Buffer tests : https://nodejs.org/api/buffer.html
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user