Huge News!Announcing our $40M Series B led by Abstract Ventures.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 - npm Package Compare versions

Comparing version 1.0.8 to 1.0.10

4

dist/fs-utils.d.ts

@@ -16,2 +16,3 @@ /// <reference types="node" />

* @param fileEncoding encoding of the file
* @returns Promise of void
*/

@@ -27,2 +28,3 @@ static changeFileContent(filePath: string, transformContent: (originalContent: string, filePath: string) => string | PromiseLike<string>, fileEncoding?: Parameters<Buffer['toString']>['0']): Promise<void>;

* @param fileEncoding encoding of the file
* @returns Promise of void
*/

@@ -39,2 +41,3 @@ static replaceInFile(filePath: string, matchPattern: RegExp, replacementOrBuilder: string | ((matchPattern: RegExp, filePath: string) => string | PromiseLike<string>), fileEncoding?: Parameters<Buffer['toString']>['0']): Promise<void>;

* @param fileEncoding encoding of the file
* @returns Promise of void
*/

@@ -50,2 +53,3 @@ static addSurroundingInFile(filePath: string, matchPattern: RegExp, addBefore: string, addAfter: string, fileEncoding?: Parameters<Buffer['toString']>['0']): Promise<void>;

* @param fileEncoding encoding of the files
* @returns Promise of void
*/

@@ -52,0 +56,0 @@ static replaceInFileWithFileContent(filePath: string, matchPattern: RegExp, contentFilePath: string, fileEncoding?: Parameters<Buffer['toString']>['0']): Promise<void>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceInFileWithFileContent = exports.addSurroundingInFile = exports.replaceInFile = exports.changeFileContent = exports.escapeRegExpReplacement = exports.FsUtils = void 0;
const fs = require("fs-extra");
const tslib_1 = require("tslib");
const fs = tslib_1.__importStar(require("fs-extra"));
class FsUtils {

@@ -21,2 +22,3 @@ /**

* @param fileEncoding encoding of the file
* @returns Promise of void
*/

@@ -38,2 +40,3 @@ static async changeFileContent(filePath, transformContent, fileEncoding = 'utf-8') {

* @param fileEncoding encoding of the file
* @returns Promise of void
*/

@@ -53,2 +56,3 @@ static async replaceInFile(filePath, matchPattern, replacementOrBuilder, fileEncoding = 'utf-8') {

* @param fileEncoding encoding of the file
* @returns Promise of void
*/

@@ -66,2 +70,3 @@ static async addSurroundingInFile(filePath, matchPattern, addBefore, addAfter, fileEncoding = 'utf-8') {

* @param fileEncoding encoding of the files
* @returns Promise of void
*/

@@ -68,0 +73,0 @@ static async replaceInFileWithFileContent(filePath, matchPattern, contentFilePath, fileEncoding = 'utf-8') {

5

package.json
{
"name": "@handy-common-utils/fs-utils",
"version": "1.0.8",
"version": "1.0.10",
"description": "File system operations related utilities based on fs-extra",
"scripts": {
"pretest": "eslint . --ext .ts",
"test": "nyc mocha -r ts-node/register test/**/*spec.ts",

@@ -24,3 +25,3 @@ "prepare": "shx rm -rf dist && tsc && shx chmod +x dist/bin/*.js",

"devDependencies": {
"@handy-common-utils/dev-dependencies": "^1.0.2",
"@handy-common-utils/dev-dependencies": "^1.0.9",
"@types/fs-extra": "^9.0.2",

@@ -27,0 +28,0 @@ "@types/tmp": "^0.2.0",

@@ -16,3 +16,3 @@ # @handy-common-utils/fs-utils

```javascript
import { FsUtils } from 'fs-utils';
import { FsUtils } from '@handy-common-utils/fs-utils';

@@ -163,6 +163,8 @@ const [,, filePath, matchPattern, beforeString, afterString] = process.argv;

`addAfter` | string | - | the string to be added before the capturing group, no need to escape anything |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the file |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the file |
**Returns:** Promise\<void>
Promise of void
___

@@ -184,6 +186,8 @@

`transformContent` | (originalContent: string, filePath: string) => string \| PromiseLike\<string> | - | function for getting the new file content |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the file |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the file |
**Returns:** Promise\<void>
Promise of void
___

@@ -224,6 +228,8 @@

`replacementOrBuilder` | string \| (matchPattern: RegExp, filePath: string) => string \| PromiseLike\<string> | - | The replacement string or a function for building the replacement string. Please note that you can use special replacement patterns but also you need to take care of the escaping. For details of special replacement patterns see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the file |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the file |
**Returns:** Promise\<void>
Promise of void
___

@@ -244,5 +250,7 @@

`contentFilePath` | string | - | path of the file for getting the replacement content |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the files |
`fileEncoding` | Parameters\<Buffer[\"toString\"]>[\"0\"] | "utf-8" | encoding of the files |
**Returns:** Promise\<void>
Promise of void
<!-- API end -->

Sorry, the diff of this file is not supported yet

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