Documentation Index
Fetch the complete documentation index at: https://projectdiscovery.sec-lab.cn/llms.txt
Use this file to discover all available pages before exploring further.
命名空间: fs
ListDir
▸ ListDir(path, itemType): string[] | null
ListDir 根据提供的 itemType 列出目录中的 itemType 值
itemType 可以是 [‘file’,‘dir’,”] 中的任意一个
| 名称 | 类型 |
|---|
path | string |
itemType | string |
返回值
string[] | null
示例
const fs = require('nuclei/fs');
// 这将仅返回 /tmp 目录中的文件
const files = fs.ListDir('/tmp', 'file');
示例
const fs = require('nuclei/fs');
// 这将仅返回 /tmp 目录中的目录
const dirs = fs.ListDir('/tmp', 'dir');
示例
const fs = require('nuclei/fs');
// 当没有提供 itemType 时,它将返回文件和目录
const items = fs.ListDir('/tmp');
定义于
fs.ts:26
ReadFile
▸ ReadFile(path): Uint8Array | null
ReadFile 读取允许路径内的文件内容
并以 byte 数组形式返回内容
返回值
Uint8Array | null
示例
const fs = require('nuclei/fs');
// 这里允许的目录是 $HOME/nuclei-templates/*
const content = fs.ReadFile('helpers/usernames.txt');
定义于
fs.ts:42
ReadFileAsString
▸ ReadFileAsString(path): string | null
ReadFileAsString 读取允许路径内的文件内容
并以字符串形式返回内容
返回值
string | null
示例
const fs = require('nuclei/fs');
// 这里允许的目录是 $HOME/nuclei-templates/*
const content = fs.ReadFileAsString('helpers/usernames.txt');
定义于
fs.ts:58
ReadFilesFromDir
▸ ReadFilesFromDir(dir): string[] | null
ReadFilesFromDir 从目录中读取所有文件
并返回包含所有文件内容的字符串数组
返回值
string[] | null
示例
const fs = require('nuclei/fs');
// 这里允许的目录是 $HOME/nuclei-templates/*
const contents = fs.ReadFilesFromDir('helpers/ssh-keys');
log(contents);
定义于
fs.ts:75