Skip to content

mayalust/ps-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ps-file

package used to simplify your writing or reading file

install

npm i ps-file@latest

import

let psfile = require('ps-file');

usage

1,read file

let psfile = require('ps-file'),
    pathLib = require('path'),
    workpath = process.cwd();
psfile(pathLib.resolve(workpath, './file'))
    .read()
    .then(content => {
        console.log(content);
    })

2,write file

let psfile = require('ps-file'),
    pathLib = require('path'),
    workpath = process.cwd();
psfile(pathLib.resolve(workpath, './file'))
    .write('hello worlk')
    .then(node => {
        console.log('success');
    })

3,load file contents of current folder recusively.

let psfile = require('ps-file'),
    pathLib = require('path'),
    workpath = process.cwd();
psfile(pathLib.resolve(workpath, './file'))
    .children((node) => true)
    .then(nodes => {
        return new Promise(nodes.map( node => {
            return node.read()
        }))
    }).then(contents => {
        console.log(contents);
    })

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published