Skip to main content

searchFiles

codebolt.fs.searchFiles(path: string, regex: string, filePattern: string): Promise<SearchFilesResponse>
Searches files in a given path using a regex pattern.

Parameters

NameTypeDescription
pathstringThe path to search within.
regexstringThe regex pattern to search for.
filePatternstringThe file pattern to match files.

Returns:

 Promise<SearchFilesResponse>
A promise that resolves with the search results.

Example

// Let's assume you want to search for files in the /home/user/documents directory that match the regex pattern "example" and have a .txt extension.

codebolt.fs.searchFiles('/home/user/documents', 'example', '*.txt');