storage API

Search

Returns an array of files based on parameters

// looking for a resource in current project
await storageInterface.search("","index/");
// looking for all files inside a directory
await storageInterface.search("","js");
// looking for all files matching a glob
await storageInterface.search("","**/*.js");
// looking for more matching...
await storageInterface.search("",["**/*.js","**/*.css"]);
// change the directory under perform a search
await storageInterface.search("components/library",["**/*.js","**/*.css"]);
// return only the files which content match a regex
await storageInterface.search("","**/*.js",{pattern:"alert", flags:"i"});
// perform a search in a global component
await storageInterface.search("","**/*.js",{pattern:"alert", flags:"i"},cName);
// perform a search in a specified project ( global component will be ignored )
await storageInterface.search("","**/*.js",{pattern:"alert", flags:"i"},cName,pName);

Parameters

dir
string - directory to search on
match
string - A glob or a resource name
project
string - The base path will be changed to the one associated with the global component linked with this parameter. Component parameter will be ignored.
component
string - The base path will be changed to the one associated with the global component linked with this parameter.
component
string - The base path will be changed to the one associated with the global component linked with this parameter.

Return Value

A Promise that resolve to a JSON object structured as follows

searchResult
array- array composed by the paths of the files that match search parameters