newcore

0.2.1 • Public • Published

node core libs with promises and better errors

Currently just fs is supported.

npm install --save newcore

fs

Example:

var fs = require('newcore/lib/fs');
 
fs.readFile('lorem.txt', 'utf-8')
.then((text) => {
  console.log(text);
})
 
// selective error handling
.catch(fs.errors.NotFound, () => {
  console.log('File lorem.txt is missing');
});

Errors:

Code Error Name
EACCES fs.errros.PermissionDenied
EEXIST fs.errors.FileExists
EISDIR fs.errors.IsDirectory
ENOTDIR fs.errors.NotDirectory
ENOTEMPTY fs.errors.NotEmptyDirectory
ENOENT fs.errors.NotFound
EMFILE fs.errors.OutOfFileDescriptors
EPERM fs.errors.Permissions

Readme

Keywords

Package Sidebar

Install

npm i newcore

Weekly Downloads

1

Version

0.2.1

License

MIT

Last publish

Collaborators

  • greenjello