file-async
- All functions from fs and fs-extra to use with Promises
- No more blocking code.
- bluebird's promisified
- exists() is fixed
npm
Install with$ npm install --save file-async
Usage
var fsAsync = ; var TMP_FILE_PATH = '/tmp/file_content.js';// "touch" a new empty filereturn fsAsync;
Functions
async functions (Promises)
- access
- appendFile
- chmod
- chown
- close
- copy
- createFile
- createOutputStream
- createReadStream
- createWriteStream
- delete
- emptyDir
- emptydir
- ensureDir
- ensureFile
- exists
- fchmod
- fchown
- fdatasync
- FileReadStream
- FileWriteStream
- fstat
- fsync
- ftruncate
- futimes
- lchmod
- lchown
- link
- lstat
- lutimes
- mkdir
- mkdirp
- mkdirs
- move
- open
- outputFile
- outputJson
- outputJSON
- read
- readdir
- readFile
- readJson
- readJSON
- readJsonFile
- readJSONFile
- readlink
- ReadStream
- realpath
- remove
- rename
- rmdir
- stat
- Stats
- symlink
- truncate
- unlink
- unwatchFile
- utimes
- watch
- watchFile
- write
- writeFile
- writeJson
- writeJSON
- writeJsonFile
- writeJSONFile
- WriteStream
callback node.js old callback way (do use this)
accessCallback, appendFileCallback, chmodCallback, chownCallback, closeCallback, copyCallback, createFileCallback, createOutputStreamCallback, createReadStreamCallback, createWriteStreamCallback, deleteCallback, emptyDirCallback, emptydirCallback, ensureDirCallback, ensureFileCallback, existsCallback, fchmodCallback, fchownCallback, fdatasyncCallback, FileReadStreamCallback, FileWriteStreamCallback, fstatCallback, fsyncCallback, ftruncateCallback, futimesCallback, lchmodCallback, lchownCallback, linkCallback, lstatCallback, lutimesCallback, mkdirCallback, mkdirpCallback, mkdirsCallback, moveCallback, openCallback, outputFileCallback, outputJsonCallback, outputJSONCallback, readCallback, readdirCallback, readFileCallback, readJsonCallback, readJSONCallback, readJsonFileCallback, readJSONFileCallback, readlinkCallback, ReadStreamCallback, realpathCallback, removeCallback, renameCallback, rmdirCallback, statCallback, StatsCallback, symlinkCallback, truncateCallback, unlinkCallback, unwatchFileCallback, utimesCallback, watchCallback, watchFileCallback, writeCallback, writeFileCallback, writeJsonCallback, writeJSONCallback, writeJsonFileCallback, writeJSONFileCallback, WriteStreamCallback
sync functions (blocking code - do use this)
accessSync, existsSync, readFileSync, closeSync, openSync, readSync, writeSync, renameSync, truncateSync, ftruncateSync, rmdirSync, fdatasyncSync, fsyncSync, mkdirSync, readdirSync, fstatSync, lstatSync, statSync, readlinkSync, symlinkSync, linkSync, unlinkSync, fchmodSync, chmodSync, fchownSync, chownSync, utimesSync, futimesSync, writeFileSync, appendFileSync, realpathSync, lutimesSync, lchownSync, lchmodSync, copySync, removeSync, deleteSync, mkdirsSync, mkdirpSync, createFileSync, ensureFileSync, ensureDirSync, outputFileSync, readJsonFileSync, readJSONFileSync, readJsonSync, readJSONSync, outputJsonSync, outputJSONSync, writeJsonFileSync, writeJSONFileSync, writeJsonSync, writeJSONSync, emptyDirSync, emptydirSync
CONTRIBUTING
-
Install/Update dependencies:
$ npm install --save-dev azk-dev$ gulp editor:config$ gulp babel:runtime:install$ npm install -
Commit
$ git add .$ git commit -m 'Updated azk-dev.'
azk-dev
Show all gulp tasks:
$ gulp help
Tests
# default (lint + test, no watch) $ gulp lint test # test + lint + watch $ gulp watch:lint:test # test + watch (no-lint) $ gulp watch:test
Deploy npm package
You can deploy package with:
$ npm run deploy [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
This should run the following steps:
- Check if not tracked commits in git
- Run tests with
npm test
- Upgrade version in
package.json
, commit and add tag - Publish package in npmjs.com