Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frangio/promisified
https://github.com/frangio/promisified
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/frangio/promisified
- Owner: frangio
- Created: 2020-02-14T12:56:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-30T00:00:41.000Z (over 4 years ago)
- Last Synced: 2024-10-16T10:21:25.680Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Promisified Node.js
This is a simple module to save you from manually calling `util.promisify`.
For every Node.js module that contains async functions, there is an equivalent
module in `promisified` where those functions have been promisified using
`util.promisify`.```js
const fs = require('promisified/fs');async function main() {
const data = await fs.readFile('data.txt', 'utf8');
}
```Note that in some cases there are already promisified versions built into
Node.js itself, such as [`fs.promises`], also available as
`require('fs/promises')` in Node.js v14. This package does not use those; it
always uses `util.promisify`.[`fs.promises`]: https://nodejs.org/api/fs.html#fs_fs_promises_api