replace-in-file

  • Version 8.3.0
  • Published
  • 277 kB
  • 3 dependencies
  • MIT license

Install

npm i replace-in-file
yarn add replace-in-file
pnpm add replace-in-file

Overview

A simple utility to quickly replace text in one or more files.

Index

Namespaces

namespace replace-in-file

module 'replace-in-file' {}

    function replaceInFile

    replaceInFile: typeof replaceInFile;

      function replaceInFileSync

      replaceInFileSync: (config: ReplaceInFileConfig) => ReplaceResult[];

        interface ReplaceInFileConfig

        interface ReplaceInFileConfig {}

          property allowEmptyPaths

          allowEmptyPaths?: boolean;

            property countMatches

            countMatches?: boolean;

              property disableGlobs

              disableGlobs?: boolean;

                property dry

                dry?: boolean;

                  property encoding

                  encoding?: string;

                    property files

                    files: string | string[];

                      property from

                      from?: From | Array<From>;

                        property glob

                        glob?: object;

                          property ignore

                          ignore?: string | string[];

                            property processor

                            processor?: ProcessorCallback | Array<ProcessorCallback>;

                              property processorAsync

                              processorAsync?: ProcessorAsyncCallback | Array<ProcessorAsyncCallback>;

                                property to

                                to?: To | Array<To>;

                                  method getTargetFile

                                  getTargetFile: (source: string) => string;

                                    interface ReplaceResult

                                    interface ReplaceResult {}

                                      property file

                                      file: string;

                                        property hasChanged

                                        hasChanged: boolean;

                                          property numMatches

                                          numMatches?: number;

                                            property numReplacements

                                            numReplacements?: number;

                                              type From

                                              type From = string | RegExp | FromCallback;

                                                type To

                                                type To = string | ToCallback;

                                                  namespace replace-in-file.replaceInFile

                                                  namespace replace-in-file.replaceInFile {}

                                                    function replaceInFile

                                                    replaceInFile: (config: ReplaceInFileConfig) => Promise<ReplaceResult[]>;

                                                      function replaceInFileSync

                                                      replaceInFileSync: (config: ReplaceInFileConfig) => ReplaceResult[];

                                                        Package Files (1)

                                                        Dependencies (3)

                                                        Dev Dependencies (6)

                                                        Peer Dependencies (0)

                                                        No peer dependencies.

                                                        Badge

                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/replace-in-file.

                                                        • Markdown
                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/replace-in-file)
                                                        • HTML
                                                          <a href="https://www.jsdocs.io/package/replace-in-file"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>