public delete(filepath: string, options?: { force?: boolean; }): boolean
Delete the specified filepath. Will delete files and folders recursively.
Parameters
filepath: string
options?: { force?: boolean; }optional
Returns
boolean
true if the files could be deleted, otherwise false.
public doesPathContain(ancestorPath: string, decendantPaths: Array<string>): boolean
Are all descendant path(s) contained within the specified ancestor path?
Parameters
ancestorPath: string
decendantPaths: Array<string>
Returns
boolean
public exists(path: string, append?: Array<string>): boolean
Does the given path exist?
Parameters
path: string
append?: Array<string>optional
Returns
boolean
public expand(patterns: Array<string>): Array<string>
Return a unique array of all file or directory paths that match the given globbing pattern(s).
This method accepts either comma separated globbing patterns or an array of globbing patterns.
Paths matching patterns that begin with ! will be excluded from the returned array.
Patterns are processed in order, so inclusion and exclusion order is significant.
File paths are relative to the Gruntfile unless the current working directory is changed with
grunt.file.setBase or the --base command-line option.
Parameters
patterns: Array<string>
Returns
Array<string>
public expand(options: IFilesConfig, patterns: Array<string>): Array<string>
Returns an array of src-dest file mapping objects.
For each source file matched by a specified pattern, join that file path to the specified dest.
This file path may be flattened or renamed, depending on the options specified.
see
FileModule.expand method documentation for an explanation of how the patterns
and options arguments may be specified.
public isPathAbsolute(path: string, append?: Array<string>): boolean
Is a given file path absolute?
Parameters
path: string
append?: Array<string>optional
Returns
boolean
public isPathCwd(path: string, append?: Array<string>): boolean
Is a given file path the current working directory (CWD)?
Parameters
path: string
append?: Array<string>optional
Returns
boolean
public match(pattern: string, filepath: string): Array<string>
Match one or more globbing patterns against one or more file paths.
Returns a uniqued array of all file paths that match any of the specified globbing patterns.
Both the patterns and filepaths argument can be a single string or array of strings.
Paths matching patterns that begin with ! will be excluded from the returned array.
Patterns are processed in order, so inclusion and exclusion order is significant.
Parameters
pattern: string
filepath: string
Returns
Array<string>
public match(pattern: string, filepaths: Array<string>): Array<string>
Parameters
pattern: string
filepaths: Array<string>
Returns
Array<string>
public match(patterns: Array<string>, filepath: string): Array<string>
Parameters
patterns: Array<string>
filepath: string
Returns
Array<string>
public match(patterns: Array<string>, filepaths: Array<string>): Array<string>
Parameters
patterns: Array<string>
filepaths: Array<string>
Returns
Array<string>
public match(options: IMinimatchOptions, pattern: string, filepath: string): Array<string>
Recurse into a directory, executing callback for each file.
Callback args:
abspath - The full path to the current file,
which is nothing more than the rootdir + subdir + filename arguments, joined.
rootdir - The root director, as originally specified.
subdir - The current file's directory, relative to rootdir.
filename - The filename of the current file, without any directory parts.
public setBase(path: string, append?: Array<string>)
Change grunt's current working directory (CWD).
By default, all file paths are relative to the Gruntfile.
This works just like the --base command-line option.
Parameters
path: string
append?: Array<string>optional
public write(filepath: string, contents: string, options?: IFileEncodedOption)
Write the specified contents to a file, creating intermediate directories if necessary.
Strings will be encoded using the specified character encoding, Buffers will be written to disk as-specified.