forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fs-ext.d.ts
102 lines (91 loc) · 4.7 KB
/
fs-ext.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Type definitions for fs-ext
// Project: https://github.com/baudehlo/node-fs-ext
// Definitions by: Oguzhan Ergin <https://github.com/OguzhanE>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../node/node.d.ts"/>
declare module "fs-ext" {
export * from "fs";
/**
* Asynchronous flock(2). No arguments other than a possible error are passed to the callback.
* @param fd File Descriptor
* @param flags Flags can be 'sh', 'ex', 'shnb', 'exnb', 'un' and correspond to the various LOCK_SH, LOCK_EX, LOCK_SH|LOCK_NB, etc.
**/
export function flock(fd: number, flags: string, callback: (err: Error) => void): void;
/**
* Synchronous flock(2). Throws an exception on error.
* @param fd File Descriptor
* @param flags Flags can be 'sh', 'ex', 'shnb', 'exnb', 'un' and correspond to the various LOCK_SH, LOCK_EX, LOCK_SH|LOCK_NB, etc.
**/
export function flockSync(fd: number, flags: string):void;
/**
* Asynchronous fcntl(2).
* @param fd File Descriptor
* @param cmd The supported commands are: 'getfd' ( F_GETFD ) , 'setfd' ( F_SETFD )
* Requiring this module adds FD_CLOEXEC to the constants module, for use with F_SETFD.
* @param arg arg
**/
export function fcntl(fd: number, cmd: string, arg: number, callback: (err: Error, result: number) => void):void;
/**
* Asynchronous fcntl(2).
* @param fd File Descriptor
* @param cmd The supported commands are: 'getfd' ( F_GETFD ) , 'setfd' ( F_SETFD )
* Requiring this module adds FD_CLOEXEC to the constants module, for use with F_SETFD.
**/
export function fcntl(fd: number, cmd: string, callback: (err: Error, result: number) => void):void;
/**
* Synchronous fcntl(2). Throws an exception on error.
* @param fd File Descriptor
* @param cmd The supported commands are: 'getfd' ( F_GETFD ) , 'setfd' ( F_SETFD )
* Requiring this module adds FD_CLOEXEC to the constants module, for use with F_SETFD.
* @param arg arg
* @return Returns flags
**/
export function fcntlSync(fd: number, cmd: string, arg?: number): number;
/**
* Asynchronous lseek(2).
* @param fd File Descriptor
* @param offset Offset
* @param whence
* Whence can be 0 (SEEK_SET) to set the new position in bytes to offset, 1 (SEEK_CUR) to set the new
* position to the current position plus offset bytes (can be negative), or 2 (SEEK_END) to set to the end
* of the file plus offset bytes (usually negative or zero to seek to the end of the file).
**/
export function seek(fd: number, offset: number, whence: number, callback: (err: Error, currFilePos: number) => void): void;
/**
* Synchronous lseek(2). Throws an exception on error. Returns current file position.
* @param fd File Descriptor
* @param offset Offset
* @param whence
* Whence can be 0 (SEEK_SET) to set the new position in bytes to offset, 1 (SEEK_CUR) to set the new
* position to the current position plus offset bytes (can be negative), or 2 (SEEK_END) to set to the end
* of the file plus offset bytes (usually negative or zero to seek to the end of the file).
* @returns Returns current file position.
**/
export function seekSync(fd: number, offset: number, whence: number): number;
/**
* Asynchronous utime(2).
* @param path File path
* @param atime
* Arguments atime and mtime are in seconds as for the system call.Note that the number value of Date() is in milliseconds,
* so to use the 'now' value with fs.utime() you would have to divide by 1000 first, e.g. Date.now()/1000
* Just like for utime(2), the absence of the atime and mtime means 'now'.
* @param mtime
* Arguments atime and mtime are in seconds as for the system call.Note that the number value of Date() is in milliseconds,
* so to use the 'now' value with fs.utime() you would have to divide by 1000 first, e.g. Date.now()/1000
* Just like for utime(2), the absence of the atime and mtime means 'now'.
**/
export function utime(path: string, atime: number, mtime: number, callback: (err: Error) => void):void;
/**
* Synchronous version of utime(). Throws an exception on error.
* @param path File path
* @param atime
* Arguments atime and mtime are in seconds as for the system call.Note that the number value of Date() is in milliseconds,
* so to use the 'now' value with fs.utime() you would have to divide by 1000 first, e.g. Date.now()/1000
* Just like for utime(2), the absence of the atime and mtime means 'now'.
* @param mtime
* Arguments atime and mtime are in seconds as for the system call.Note that the number value of Date() is in milliseconds,
* so to use the 'now' value with fs.utime() you would have to divide by 1000 first, e.g. Date.now()/1000
* Just like for utime(2), the absence of the atime and mtime means 'now'.
**/
export function utimeSync(path: string, atime: number, mtime: number):void;
}