Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/generated/ts/fs.ts
2070 views
1
2
3
/**
4
* ListDir lists itemType values within a directory
5
* depending on the itemType provided
6
* itemType can be any one of ['file','dir',”]
7
* @example
8
* ```javascript
9
* const fs = require('nuclei/fs');
10
* // this will only return files in /tmp directory
11
* const files = fs.ListDir('/tmp', 'file');
12
* ```
13
* @example
14
* ```javascript
15
* const fs = require('nuclei/fs');
16
* // this will only return directories in /tmp directory
17
* const dirs = fs.ListDir('/tmp', 'dir');
18
* ```
19
* @example
20
* ```javascript
21
* const fs = require('nuclei/fs');
22
* // when no itemType is provided, it will return both files and directories
23
* const items = fs.ListDir('/tmp');
24
* ```
25
*/
26
export function ListDir(path: string, itemType: string): string[] | null {
27
return null;
28
}
29
30
31
32
/**
33
* ReadFile reads file contents within permitted paths
34
* and returns content as byte array
35
* @example
36
* ```javascript
37
* const fs = require('nuclei/fs');
38
* // here permitted directories are $HOME/nuclei-templates/*
39
* const content = fs.ReadFile('helpers/usernames.txt');
40
* ```
41
*/
42
export function ReadFile(path: string): Uint8Array | null {
43
return null;
44
}
45
46
47
48
/**
49
* ReadFileAsString reads file contents within permitted paths
50
* and returns content as string
51
* @example
52
* ```javascript
53
* const fs = require('nuclei/fs');
54
* // here permitted directories are $HOME/nuclei-templates/*
55
* const content = fs.ReadFileAsString('helpers/usernames.txt');
56
* ```
57
*/
58
export function ReadFileAsString(path: string): string | null {
59
return null;
60
}
61
62
63
64
/**
65
* ReadFilesFromDir reads all files from a directory
66
* and returns a string array with file contents of all files
67
* @example
68
* ```javascript
69
* const fs = require('nuclei/fs');
70
* // here permitted directories are $HOME/nuclei-templates/*
71
* const contents = fs.ReadFilesFromDir('helpers/ssh-keys');
72
* log(contents);
73
* ```
74
*/
75
export function ReadFilesFromDir(dir: string): string[] | null {
76
return null;
77
}
78
79
80