The text
utility makes it easier to read and write to any file within in your checks.
This utility expects an absolute path to a JSON file and returns an object with methods that help you read and write to any file.
exists
Returns a boolean value indicating whether or not the file exists on disk.
get
Returns the contents of a file as an array of strings representing each line. If the file does not exist, undefined
will be returned.
contains
An array of strings, representing lines of text.
Returns a boolean value indicating whether specified lines exist in the file. If the file does not exist, false
will be returned.
set
Overwrites the entire contents of a file with the provided lines of text. If the file does not exist, it will be created.
An array of strings, representing lines of text.
remove
Removes lines of text from a file, if they exist. Lines of text that are not included in the array will not be affected.
An array of strings, representing lines of text.
delete
Deletes a file from disk.
The text
utility makes it easier to read and write to any file within in your checks.
This utility expects an absolute path to a JSON file and returns an object with methods that help you read and write to any file.
exists
Returns a boolean value indicating whether or not the file exists on disk.
get
Returns the contents of a file as an array of strings representing each line. If the file does not exist, undefined
will be returned.
contains
An array of strings, representing lines of text.
Returns a boolean value indicating whether specified lines exist in the file. If the file does not exist, false
will be returned.
set
Overwrites the entire contents of a file with the provided lines of text. If the file does not exist, it will be created.
An array of strings, representing lines of text.
remove
Removes lines of text from a file, if they exist. Lines of text that are not included in the array will not be affected.
An array of strings, representing lines of text.
delete
Deletes a file from disk.