@acce/promise-fs 中文文档教程
Promise FS
这个包提供了一个围绕节点 fs 包的基于承诺的包装器。 本质上,它柯里化了回调函数,并在其位置提供了一个承诺。
目前这只支持一些简单的接口,如下所列。
- mkdir
- mkdtemp
- lstat
- readdir
- readFile
- writeFile
- mkdtemp
- rename
- rmdir
- unlink
- remove
Example
let { writeFile } = require('@acce/promise-fs')
writeFile('./some.txt', 'foo bar', 'utf8')
.then(() => do.something())
.catch(e => console.error('Oh snap.', e))
Installing
npm i --save @acce/promise-fs
Contributing
随意添加额外的模块,我会在有用的地方合并。 我有点松懈,所以也许叉子?...
Promise FS
This package provides a promise based wrapper around the node fs package. Essentially, it curries the callback function, and provides a promise in its place.
Currently this only supports a few simple interfaces, listed bellow.
- mkdir
- mkdtemp
- lstat
- readdir
- readFile
- writeFile
- mkdtemp
- rename
- rmdir
- unlink
- remove
Example
let { writeFile } = require('@acce/promise-fs')
writeFile('./some.txt', 'foo bar', 'utf8')
.then(() => do.something())
.catch(e => console.error('Oh snap.', e))
Installing
npm i --save @acce/promise-fs
Contributing
Feel free to add extra modules, I'll merge where useful. I'm kinda slack so maybe fork?…