-
Notifications
You must be signed in to change notification settings - Fork 0
/
filesystem.d.ts
49 lines (44 loc) · 1.67 KB
/
filesystem.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
declare namespace include {
export interface Filesystem {
/**
* Reads a file asynchronously.
* @param path The path to read from.
* @param callback This will get called when the operation is finished
*/
readAsync(path: string, callback: (err: number, content: Buffer) => void): void;
/**
*
* @param path The path to write to
* @param data The data to write (see util.stringToBuffer to convert a string to a buffer)
* @param callback This will get called when the operation is finished
*/
writeAsync(path: string, data: Buffer, callback: (err: number) => void): void;
/**
* Reads a file from the path specified.
* @param path The relative path from the script.
*/
read(path: string): Buffer;
/**
* Writes a file to the path specified.
* @param path The relative path from the script.
* @param data The data to write. For example, `util.stringToBuffer("hello")`
*/
write(path: string, data: Buffer): void;
/**
* Checks if a file or a directory exists
* @param path The path to check if a file or directory exists
*/
exists(path: string): boolean;
/**
* Creates a folder/directory.
* @param path The path to create a directory.
*/
createDirectory(path: string): void;
/**
*
* @param path The path to append to the file.
* @param data The data to append, for example, `util.bufferToString("hello")`
*/
append(path: string, data: Buffer): void;
}
}