New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@handy-common-utils/fs-utils

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@handy-common-utils/fs-utils

File system operations related utilities based on fs-extra

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@handy-common-utils/fs-utils

File system operations related utilities without any 3rd party dependency.

Version Downloads/week CI codecov

How to use

First add it as a dependency:

npm install @handy-common-utils/fs-utils

Then 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 filePath matchPattern replacement
  • replace-in-files matchPattern replacement file1 file2 file3 ...
  • replace-in-file-with-file-content filePath matchPattern contentFilePath
  • add-surrounding-in-file filePath matchPattern beforeString afterString

API

fs-utils | @handy-common-utils/fs-utils

Index

Classes

Type Aliases

Settings

Member Visibility
  • Protected
  • Inherited
Theme
OSLightDark

Modules

Generated using TypeDoc

Keywords

FAQs

Package last updated on 22 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc