/file-js

Abstract representation of a pathname

Primary LanguageJavaScriptMIT LicenseMIT

file-js

Build Status Coverage Status

Abstract representation of a pathname

Installation

npm install --save file-js

Features

  • File glob matching
  • File listings
  • File locking
  • Assert file permissions
  • Supports promises
  • Supports synchronous and asynchronous methods

Coming soon

  • File matching with regular expressions
  • Create temp files
  • Create directories via .mkdir and .mkdirp
  • Assert existence of files via .exists()
  • Watch file
  • Change permissions
  • Rename
  • Support file URI
  • Support for callbacks

Usage

const File = require('file-js');

const file = File.create('myDir');
file.getList()
  then((files) => {
    files.each(console.log);
  });

const file = File.create('myDirectory');
if (file.isDirectorySync()) {
  console.log('processing directory');
}

Documentation

For more examples and API details, see API documentation

Test

npm test

To generate a test coverage report:

npm run coverage

Contributing

  • If you're unsure if a feature would make a good addition, you can always create an issue first.
  • We aim for 100% test coverage. Please write tests for any new functionality or changes.
  • Any API changes should be fully documented.
  • Make sure your code meets our linting standards. Run npm run lint to check your code.
  • Maintain the existing coding style. There are some settings in .jsbeautifyrc to help.
  • Be mindful of others when making suggestions and/or code reviewing.