Package Exports
- fs-extra-plus
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fs-extra-plus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fs-extra + .glob() (fast-glob) + .saferRemove() (from basedir by default)
Changelogs
- 0.3.0: Simplified, and completely re-written. Just focused on what we often add on top of fs-extra. Right now, just
.glob()(fast-glob) and.saferRemove()
example
import * as fs from 'fs-extra-plus';
async function example(){
// can use the normal fs-extra function
await fs.ensureDir('/tmp/my-temp/');
await fs.copy('/tmp/myfile', '/tmp/my-temp/mynewfile')
// fs-extra-plus glob (using fast-glob)
const files = await fs.glob('**/*.js');
const files = await fs.glob(['**/*.js', '**/*.css'], 'src/');
// Note that when cwd, the return files will have the cwd in the path
// e.g., files[0] === 'src/some.ts' (and not as 'some.ts' as in raw fast-glob)
// or full fast-glob options
const files = await fs.glob(['**/*.js', '**/*.css'], {cwd: 'src/', deep: 3});
// fs-extra-plus saferRemove
fs.saferRemove('../somedir'); // >> Throw error, seems not safe, does not belong to current dir
fs.saferRemove('/etc/'); // >> Throw error, seems not safe, does not belong to current dir
fs.saferRemove('some-file-in-basedir'); // >> will delete
fs.saferRemove(['some-dir/some-file'],'/tmp/'); // >> will delete `some-dir/some-file` from the `/tmp/` dir.
}