• Version 6.4.0
  • Published
  • 20.1 kB
  • 6 dependencies
  • MIT license


npm i read-config-file
yarn add read-config-file
pnpm add read-config-file


Read configuration file in various formats:



function findAndReadConfig

findAndReadConfig: <T>(
request: ReadConfigRequest
) => Promise<ReadConfigResult<T> | null>;

    function getConfig

    getConfig: <T>(
    request: ReadConfigRequest,
    configPath?: string | null
    ) => Promise<ReadConfigResult<T> | null>;

      function loadConfig

      loadConfig: <T>(
      request: ReadConfigRequest
      ) => Promise<ReadConfigResult<T> | null>;

        function loadEnv

        loadEnv: (envFile: string) => Promise<import('dotenv').DotenvParseOutput | null>;

          function loadParentConfig

          loadParentConfig: <T>(
          request: ReadConfigRequest,
          spec: string
          ) => Promise<ReadConfigResult<T>>;

            function orIfFileNotExist

            orIfFileNotExist: <T>(promise: Promise<T>, fallbackValue: T) => Promise<T>;

              function orNullIfFileNotExist

              orNullIfFileNotExist: <T>(promise: Promise<T>) => Promise<T | null>;


                interface ReadConfigRequest

                interface ReadConfigRequest {}

                  property configFilename

                  configFilename: string;

                    property packageKey

                    packageKey: string;

                      property packageMetadata

                      packageMetadata: Lazy<{
                      [key: string]: any;
                      } | null> | null;

                        property projectDir

                        projectDir: string;

                          interface ReadConfigResult

                          interface ReadConfigResult<T> {}

                            property configFile

                            readonly configFile: string | null;

                              property result

                              readonly result: T;

                                Package Files (1)

                                Dependencies (6)

                                Dev Dependencies (3)

                                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>