Package Exports
- @handy-common-utils/fs-utils
- @handy-common-utils/fs-utils/dist/fs-utils.js
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 (@handy-common-utils/fs-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@handy-common-utils/fs-utils
File system operations related utilities without any 3rd party dependency.
How to use
First add it as a dependency:
npm install @handy-common-utils/fs-utilsThen you can use it in the code:
import { FsUtils } from '@handy-common-utils/fs-utils';
const [,, filePath, matchPattern, beforeString, afterString] = process.argv;
await FsUtils.addSurroundingInFile(filePath, new RegExp(matchPattern), beforeString, afterString);You can either import and use the class as shown above, or you can import individual functions directly like below:
import { addSurroundingInFile } from 'fs-utils';
await addSurroundingInFile(README_MD_FILE, /<example>(.*?)<\/example>/gms, '<example><b>', '</b></example>');There are also several commands you can use directly from your shell/build scripts:
- replace-in-file
filePathmatchPatternreplacement - replace-in-files
matchPatternreplacementfile1file2file3... - replace-in-file-with-file-content
filePathmatchPatterncontentFilePath - add-surrounding-in-file
filePathmatchPatternbeforeStringafterString
API
Generated using TypeDoc
Re-exports
Functions
Exports