easyfile

0.2.0 • Public • Published

easyfile

Super tiny and useful file uitls.

Install

npm install easyfile --save

What easyfile do?

  1. Map some sync method as default name:
easyfile.exists = fs.existsSync;
easyfile.chmod = fs.chmodSync;
easyfile.chown = fs.chownSync;
easyfile.append = fs.appendeasyfileSync;
easyfile.stat = fs.statSync;
easyfile.read = fs.readeasyfileSync;
easyfile.readlink = fs.readlinkSync;
easyfile.readdir = fs.readdirSync;
easyfile.rename = fs.renameSync;
easyfile.rmdir = fs.rmdirSync;
easyfile.unlink = fs.unlinkSync;
  1. mkdir is mddirp
easyfile.mkdir('/newpath/newpath/newpath');
  1. copy support file and dir
easyfile.copy('fromfile', 'tofile');
easyfile.copy('fromdir', 'todir');

When copy dir, some file or sub directory not you want could be filter:

easyfile.copy('fromdir', 'todir', {
  // only copy js file
  filter: filepath => path.extname(filepath) === '.js'
})
  1. write could force write and backup
easyfile.write('tofile', data, {
  force: true,
  backup: true
});

Readme

Keywords

Package Sidebar

Install

npm i easyfile

Weekly Downloads

8

Version

0.2.0

License

ISC

Unpacked Size

6.54 kB

Total Files

3

Last publish

Collaborators

  • yuanyan