Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-gax

Package Overview
Dependencies
Maintainers
4
Versions
362
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-gax

Google API Extensions

  • 4.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7M
decreased by-11.46%
Maintainers
4
Weekly downloads
 
Created

What is google-gax?

The google-gax (Google API Extensions) package is a set of libraries for making Google API client libraries. It provides functionality such as automatic retries, page iteration, and request bundling. It is mainly used internally by Google's auto-generated client libraries for Node.js.

What are google-gax's main functionalities?

Automatic Retries

This feature allows developers to specify retry logic for failed requests. The RetryOptions class can be used to define backoff settings for retries.

const {RetryOptions} = require('google-gax');
const retryOptions = new RetryOptions(
  [100, 200, 400, 800, 1600],
  RetryOptions.createRetryPolicy()
);

Page Iteration

This feature simplifies the process of iterating over multiple pages of API response data. The createApiCall function can be configured to handle pagination automatically.

const {createApiCall} = require('google-gax');
const apiCall = createApiCall(
  promiseFunc,
  {autoPaginate: true}
);
const resources = [];
apiCall({},
  (err, response, nextPageRequest, rawResponse) => {
    resources.push(...response);
    if (nextPageRequest) {
      // More results to fetch
    }
  }
);

Request Bundling

Request bundling allows developers to combine multiple API calls into a single request to reduce network overhead. The BundleDescriptor and BundleExecutor classes are used to define and execute bundled requests.

const {BundleDescriptor, BundleExecutor} = require('google-gax');
const descriptor = new BundleDescriptor(
  'bundled_field',
  ['field1', 'field2'],
  'bundled_field',
  1024
);
const executor = new BundleExecutor({descriptor});

Other packages similar to google-gax

Keywords

FAQs

Package last updated on 04 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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