Skip to main content

searchFiles

codebolt.fs.searchFiles(folderpath: string, regex: RegExp, filePattern: string): Promise<SearchFilesResponse>

Parameters

NameTypeDescription
folderpathstringThe path of the folder to search within.
regexRegExpThe regular expression pattern to match file contents.
filePatternstringThe pattern to match file names.

Returns:

 Promise<SearchFilesResponse>
A promise that resolves with the server response.

Example

let { success, result } = await codebolt.fs.searchFiles(path, regex, filePattern);
return [success, result]

Explaination

The codebolt.fs.searchFiles method is used to search for files within a specified directory that match a given pattern. It has three parameters:

folderpath (string): The path of the folder to search within.

regex (RegExp): The regular expression pattern to match file contents.

filePattern (string): The pattern to match file names.