1.0.3 • Published 6 years ago

n-files v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

node-files

node files is node promise based that provide easy way dealing with files

  • open your directory and install node-files as dependency
npm i n-files
  • import the module
const nfs = require('n-files');
//or 
const {read} = require('n-files');

Example

(async function x() {
        let file = await nfs.read('./LICENSE');
        let files = await nf.filesInDir();
        // loop on every single line of the file 
        for (let line of file.lines())
            if(line.startsWith('Copyright')) 
                console.log(line); // Copyright (c) 2017 Hosam Elnabawy
        console.log(file.count);   // 17
        console.log(files.map(file =>extname(file)||file)); // [ '.gitignore', '.js', 'LICENSE', '.json', '.md', '.js' ]

});