A minimal toolbox of helper methods
$ npm install --save util-box
Minimal utility methods for HTTP Requests and Responses.
Methods for color-coded logging.
Methods for logging how long an operation runs for.
Methods for basic file reading, writing, deleting, truncating
Removes a trailing slash from the end of a url, if present.
Converts request parameters into a queryString. The input reqParams
is an object with key-value pairs of each query parameter and their corresponding values.
This handles a generic Api Response from different request libraries by returning a Promise. Additionally, it also rejects with an error for non-2xx
responses.
Logs the specified message to stdout in chalk green.:
Logs the specied message to stdout as an error in chalk red.
Logs the specified message to stdout in chalk grey, only if the DEBUG
variable is set in process.env
type (optional) denotes char-set, default="UTF-8"
Read from an existing file. Returns a promise resolved with the data read from the file.
Create/write to a file. Returns a promise with the fileName after successfully writing to file.
Truncates / Empties the contents of a file
Deletes the specified file