Skip to main content

Kinetica JavaScript API

The JavaScript API for a web page is a single file, dist/standalone/GPUdb.js, available from the kinetica-api-typescript repository and in the @kinetica/gpudb-api npm package. Load it with a <script> tag; it defines a global GPUdb class:

Only the GPUdb class is global. Everything else is reached through it: GPUdb.Type (and GPUdb.Type.Column), GPUdb.FileHandler, GPUdb.RingList, GPUdb.encode / decode, GPUdb.END_OF_SET, GPUdb.VERSION, and the other static members listed on the class.

Unlike the npm package’s other builds, this file makes synchronous requests by default: an endpoint called without a callback blocks and returns its response, as the earlier JavaScript API did. Pass a callback, or construct the client with sync: false to get promises instead:

Synchronous requests block the browser’s UI thread and are deprecated by browsers, so treat them as a migration aid. The transport is chosen automatically: fetch, or a blocking XMLHttpRequest for synchronous calls.

Applications built with a bundler (webpack, Vite, esbuild) should instead install @kinetica/gpudb-api and import it; see the TypeScript API reference.