5.2.0 • Published 2 years ago

m-fs v5.2.0

Weekly downloads
54
License
MIT
Repository
github
Last release
2 years ago

m-fs

Build Status npm version Node.js Version

Helper functions for node fs.

Installation

npm add m-fs

Usage

import * as mfs from 'm-fs';

API

readFileAsync

Calls fs.promises.readFile.

writeFileAsync

Calls fs.promises.writeFile. This method also makes ensure the target directory is created before writing the file.

statAsync

Calls fs.promises.stat.

statOrNullAsync

Like statAsync, but instead of throwing an error, it returns null in that case.

pathExists, dirExists, fileExists

Returns true if the given path/directory/file exists.

subPaths, subDirs, subFiles

await subPaths('./data/docs');
// ['backup', 'resume.pdf', 'readme.md']

await subPathsWithType('./data/docs');
// [{ path: 'backup', isFile: false }, { path: 'resume.pdf', isFile: true }, { path: 'readme.md', isFile: true }]

await subDirs('./data/docs');
// ['backup']

await subFiles('./data/docs');
// ['resume.pdf', 'readme.md']

mkdirp

Calls fs.promises.mkdir with { recursive: true }.

5.2.0

2 years ago

5.1.0

2 years ago

5.0.0

3 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

7 years ago