• Version 4.3.1
  • Published
  • 59.6 kB
  • 2 dependencies
  • Apache-2.0 license


npm i gcp-metadata
yarn add gcp-metadata
pnpm add gcp-metadata


Get the metadata from a Google Cloud Platform environment



variable BASE_PATH

const BASE_PATH: string;

    variable HEADER_NAME

    const HEADER_NAME: string;

      variable HEADER_VALUE

      const HEADER_VALUE: string;

        variable HEADERS

        const HEADERS: Readonly<{ 'Metadata-Flavor': string }>;

          variable HOST_ADDRESS

          const HOST_ADDRESS: string;

            variable SECONDARY_HOST_ADDRESS

            const SECONDARY_HOST_ADDRESS: string;


              function instance

              instance: <T = any>(options?: string | Options) => Promise<T>;
              • Obtain metadata for the current GCE instance

              function isAvailable

              isAvailable: () => Promise<boolean>;
              • Determine if the metadata server is currently available.

              function project

              project: <T = any>(options?: string | Options) => Promise<T>;
              • Obtain metadata for the current GCP Project.

              function requestTimeout

              requestTimeout: () => number;
              • Obtain the timeout for requests to the metadata server.

              function resetIsAvailableCache

              resetIsAvailableCache: () => void;
              • reset the memoized isAvailable() lookup.


              interface Options

              interface Options {}

                property headers

                headers?: OutgoingHttpHeaders;

                  property params

                  params?: {
                  [index: string]: string;

                    property property

                    property?: string;

                      Package Files (1)

                      Dependencies (2)

                      Dev Dependencies (20)

                      Peer Dependencies (0)

                      No peer dependencies.


                      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/gcp-metadata.

                      • Markdown
                      • HTML
                        <a href="https://www.jsdocs.io/package/gcp-metadata"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>