• Version 8.1.0
  • Published
  • 273 kB
  • 3 dependencies
  • MIT license


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


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



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 to

                              to?: To | Array<To>;

                                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.


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

                                                    You may also use to create a custom badge linking to

                                                    • Markdown
                                                    • HTML
                                                      <a href=""><img src="" alt=""></a>