lhl 6ff0e96ad3 8-4-1 1 gadu atpakaļ
..
lib 6ff0e96ad3 8-4-1 1 gadu atpakaļ
node_modules 6ff0e96ad3 8-4-1 1 gadu atpakaļ
History.md 6ff0e96ad3 8-4-1 1 gadu atpakaļ
LICENSE 6ff0e96ad3 8-4-1 1 gadu atpakaļ
README.md 6ff0e96ad3 8-4-1 1 gadu atpakaļ
glob.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
index.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
mkdirp.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
nextTick.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
package.json 6ff0e96ad3 8-4-1 1 gadu atpakaļ
pump.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
rimraf.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
setImmediate.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ
sleep.js 6ff0e96ad3 8-4-1 1 gadu atpakaļ

README.md

mz-modules

Same as mz, but wrap many popular modules rather than core API.

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Node require >= 4.0.0

Usage

Install it

$ npm i mz-modules

Require it

const mkdirp = require('mz-modules/mkdirp');

You can also require it from the main entry, but it will load other modules in mz-modules.

const mkdirp = require('mz-modules').mkdirp;

Use it

// Using promise
mkdirp('/path/to/dir').then(() => console.log('done'));

// Or if you are using async function
async function doSomething() {
  await mkdirp('/path/to/dir');
}

Warning: nextTick and setImmediate is little slower than callback, because promise queue is after nextTick.

Modules

  • mz-modules/mkdirp wrapped mkdirp
  • mz-modules/rimraf wrapped rimraf
  • mz-modules/glob wrapped glob
  • mz-modules/sleep wrapped ko-sleep
  • mz-modules/nextTick wrapped process.nextTick
  • mz-modules/setImmediate wrapped setImmediate
  • mz-modules/pump wrapped pump

Contribute

You can request adding module to mz-modules

  1. Create a issue let us know why you want to add the module.
  2. Add a module, named xx
    • create xx.js that exports a function should return promise.
    • require xx.js in index.js
    • add a testcase for it in test/xx.test.js
    • add xx.js to files in package.json
  3. Create a pull request

License

MIT