promise-split
v1.0.2
Published
`promise-split` is simple utility that allows you to write cleaner code when working with async/await. Skip the need to wrap `await` inside a try/catch block.
Downloads
2
Readme
promise-split
promise-split
is simple utility that allows you to write cleaner code when working with async/await. Skip the need to wrap await
inside a try/catch block.
Usage
import fs from 'fs';
import split from 'promise-split';
const readWithPromiseSplit = async (path) => {
const [file, error] = await split(fs.promises.readFile(path));
if (error) {
// Handle errors here
return 'Failed to read file';
}
return file;
}