Easy file manipulation.

Usage no npm install needed!

<script type="module">
  import easyfile from 'https://cdn.skypack.dev/easyfile';



Super tiny and useful file uitls.


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
  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