-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathfs.ts
More file actions
executable file
·78 lines (66 loc) · 1.95 KB
/
fs.ts
File metadata and controls
executable file
·78 lines (66 loc) · 1.95 KB
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
/**
* ListDir lists itemType values within a directory
* depending on the itemType provided
* itemType can be any one of ['file','dir',”]
* @example
* ```javascript
* const fs = require('nuclei/fs');
* // this will only return files in /tmp directory
* const files = fs.ListDir('/tmp', 'file');
* ```
* @example
* ```javascript
* const fs = require('nuclei/fs');
* // this will only return directories in /tmp directory
* const dirs = fs.ListDir('/tmp', 'dir');
* ```
* @example
* ```javascript
* const fs = require('nuclei/fs');
* // when no itemType is provided, it will return both files and directories
* const items = fs.ListDir('/tmp');
* ```
*/
export function ListDir(ctx: any, path: string, itemType: string): string[] | null {
return null;
}
/**
* ReadFile reads file contents within permitted paths
* and returns content as byte array
* @example
* ```javascript
* const fs = require('nuclei/fs');
* // here permitted directories are $HOME/nuclei-templates/*
* const content = fs.ReadFile('helpers/usernames.txt');
* ```
*/
export function ReadFile(ctx: any, path: string): Uint8Array | null {
return null;
}
/**
* ReadFileAsString reads file contents within permitted paths
* and returns content as string
* @example
* ```javascript
* const fs = require('nuclei/fs');
* // here permitted directories are $HOME/nuclei-templates/*
* const content = fs.ReadFileAsString('helpers/usernames.txt');
* ```
*/
export function ReadFileAsString(ctx: any, path: string): string | null {
return null;
}
/**
* ReadFilesFromDir reads all files from a directory
* and returns a string array with file contents of all files
* @example
* ```javascript
* const fs = require('nuclei/fs');
* // here permitted directories are $HOME/nuclei-templates/*
* const contents = fs.ReadFilesFromDir('helpers/ssh-keys');
* log(contents);
* ```
*/
export function ReadFilesFromDir(ctx: any, dir: string): string[] | null {
return null;
}