Package Exports
- @parzh/retryable
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@parzh/retryable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
retryable
Convenience function to retry executing an action, untill a desired result is achieved
Installation
npm install --save @parzh/retryable
yarn add @parzh/retryable
Usage
const content = await retryable((resolve, reject, retry, retryCount) => {
if (!fs.existsSync("/path/to/file"))
reject("File not found!");
else fs.readfile("/path/to/file", (err, data) => {
if (!err)
resolve(data);
else if (retryCount >= MAX_RETRY_COUNT)
reject("Max retry count reached!");
else
retry();
});
});