npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

file-async

v0.2.0

Published

fs-extra + bluebird promisify

Downloads

25

Readme

file-async

NPM

Build Status

  • All functions from fs and fs-extra to use with Promises
  • No more blocking code.
  • bluebird's promisified
  • exists() is fixed

Install with npm

$ npm install --save file-async

Usage

var fsAsync = require('file-async');

var TMP_FILE_PATH = '/tmp/file_content.js';
// "touch" a new empty file
return fsAsync.createFile(TMP_FILE_PATH).then(function () {
  // get stats
  return fsAsync.stat(TMP_FILE_PATH);
})
.then(function(file_stat) {
  // check is it is a file
  console.log(TMP_FILE_PATH, 'is a file?', file_stat.isFile());
})
.then(function() {
  // remove tmp file
  return fsAsync.remove(TMP_FILE_PATH);
})
.then(function() {
  // exists?
  return fsAsync.exists(TMP_FILE_PATH);
})
.then(function(file_exists) {
  // check again
  console.log(TMP_FILE_PATH, 'is a file?', file_exists);
});

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