Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@duckdb/node-api

Latest version: v2.0.1-r.1

Overview

Last scanned
20 Nov 2026
Published
20 Nov 2026
npm package Publisher: duckdb_admin, mraasveldt
200 Stars
55 Forks
5 Versions
15.3M Downloads
TypeScript Repo language

Scan summary

@duckdb/node-api was last scanned on 20 Nov 2026 at version 2.0.1-r.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 5 versions; the latest was published on 20 Nov 2026.
  • Findings: No rules fired in version 2.0.1-r.1.
  • Downloads: 15,333,738 downloads.

Versions

5 versions published
Versions and the rules that fired in each
VersionPublishedStatus
2.0.1-r.1 LATEST 20 Nov 2026 No rules fired
1.5.6-r.2 20 Oct 2026 No rules fired
1.5.6-r.1 28 Sep 2026 No rules fired
1.5.5-r.5 13 Sep 2026 Not shown
1.5.5-r.4 11 Aug 2026 Not shown

No rules fired in 2.0.1-r.1

Findings

Findings for v2.0.1-r.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 2.0.1-r.1; other versions have their own rules, not their own score.

Known vulnerabilities

1 CVE · last 9 Sep 2025

0 CRITICAL 1 HIGH 0 MEDIUM 0 LOW

Versions

  • ≥ 1.3.4-alpha.27
  • ≥ 1.3.3, < 1.3.4-alpha.27 1 HIGH
  • < 1.3.3

Vulnerabilities

  • CVE-2025-59037 High 9 Sep 2025 duckdb: DuckDB NPM packages 1.3.3 and 1.29.2 briefly compromised with malware Fixed in 1.3.4-alpha.27

README

The publisher’s own README, as collected from the registry.

DuckDB Node API

An API for using DuckDB in Node.

This is a high-level API meant for applications. It depends on low-level bindings that adhere closely to DuckDB's C API, available separately as @duckdb/node-bindings.

Features

Main Differences from duckdb-node
Roadmap

Some features are not yet complete. See the issues list on GitHub for the most up-to-date roadmap.

Supported Platforms
  • Linux arm64 glibc
  • Linux arm64 musl
  • Linux x64 glibc
  • Linux x64 musl
  • Mac OS X (Darwin) arm64 (Apple Silicon)
  • Mac OS X (Darwin) x64 (Intel)
  • Windows (Win32) arm64
  • Windows (Win32) x64

Examples

Get Basic Information
import duckdb from '@duckdb/node-api';

console.log(duckdb.version());

console.log(duckdb.configurationOptionDescriptions());
Connect
import { DuckDBConnection } from '@duckdb/node-api';

const connection = await DuckDBConnection.create();

This uses the default instance. For advanced usage, you can create instances explicitly.

Create Instance
import { DuckDBInstance } from '@duckdb/node-api';

Create with an in-memory database:

const instance = await DuckDBInstance.create(':memory:');

Equivalent to the above:

const instance = await DuckDBInstance.create();

Read from and write to a database file, which is created if needed:

const instance = await DuckDBInstance.create('my_duckdb.db');

Set configuration options:

const instance = await DuckDBInstance.create('my_duckdb.db', {
  threads: '4'
});
Instance Cache

Multiple instances in the same process should not attach the same database.

To prevent this, an instance cache can be used:

const instance = await DuckDBInstance.fromCache('my_duckdb.db');

This uses the default instance cache. For advanced usage, you can create instance caches explicitly:

import { DuckDBInstanceCache } from '@duckdb/node-api';

const cache = new DuckDBInstanceCache();
const instance = await cache.getOrCreateInstance('my_duckdb.db');
Connect to Instance
const connection = await instance.connect();
Disconnect

Connections will be disconnected automatically soon after their reference is dropped, but you can also disconnect explicitly if and when you want:

connection.disconnectSync();

or, equivalently:

connection.closeSync();
Run SQL
const result = await connection.run('from test_all_types()');
Parameterize SQL
const prepared = await connection.prepare('select $1, $2, $3');
prepared.bindVarchar(1, 'duck');
prepared.bindInteger(2, 42);
prepared.bindList(3, listValue([10, 11, 12]), LIST(INTEGER));
// OR, with type inference: prepared.bindList(3, [10, 11, 12]);
const result = await prepared.run();

or:

const prepared = await connection.prepare('select $a, $b, $c');
prepared.bind({
  'a': 'duck',
  'b': 42,
  'c': listValue([10, 11, 12]),
}, {
  'a': VARCHAR,
  'b': INTEGER,
  'c': LIST(INTEGER),
});
const result = await prepared.run();

or even:

const result = await connection.run('select $a, $b, $c', {
  'a': 'duck',
  'b': 42,
  'c': listValue([10, 11, 12]),
}, {
  'a': VARCHAR,
  'b': INTEGER,
  'c': LIST(INTEGER),
});

Unspecified types will be inferred:

const result = await connection.run('select $a, $b, $c', {
  'a': 'duck',
  'b': 42,
  'c': listValue([10, 11, 12]),
});
Specifying Values

Values of many data types are represented using one of the JS primitives boolean, number, bigint, or string. Also, any type can have null values.

Values of some data types need to be constructed using special functions. These are:

Type Function
ARRAY arrayValue
BIT bitValue
BLOB blobValue
DATE dateValue
DECIMAL decimalValue
INTERVAL intervalValue
LIST listValue
MAP mapValue
STRUCT structValue
STRUCT (unnamed, a tuple) tupleValue
TIME timeValue
TIMETZ timeTZValue
TIMESTAMP timestampValue
TIMESTAMPTZ timestampTZValue
TIMESTAMPTZ_NS timestampTZNanosValue
TIMESTAMP_S timestampSecondsValue
TIMESTAMP_MS timestampMillisValue
TIMESTAMP_NS timestampNanosValue
UNION unionValue
UUID uuidValue

Alternatively, jsToDuckDBValue converts a plain JS value to the form a given DuckDB type expects, so these functions need not be called directly:

import { jsToDuckDBValue, DATE, TIMESTAMP_MS } from '@duckdb/node-api';

jsToDuckDBValue(new Date('2024-01-15T12:34:56.789Z'), TIMESTAMP_MS);
// same as timestampMillisValue(1705322096789n)

jsToDuckDBValue(new Date('2024-01-15T00:00:00.000Z'), DATE);
// same as dateValue(19737)

jsToDuckDBValue(null, DATE); // null, for any type

It is generic over the type, so a statically known one checks its input:

jsToDuckDBValue(new Date(), TIMESTAMP); // ok
jsToDuckDBValue(new Date(), INTEGER);   // rejected at compile time

What each type accepts is given by JSInputTypeForTypeId, and by JSInputTypeFor when keyed by a DuckDBType. These are wider than what is read back where a second spelling is unambiguous: BIGINT and the wider integers accept number as well as bigint, and DECIMAL accepts either a double or a raw scaled bigint.

The result is a DuckDBValue, which is what appendValue, bindValue, and setRows all accept.

Stream Results

Streaming results evaluate lazily when rows are read.

const result = await connection.stream('from range(10_000)');
Close Results

Results are destroyed automatically soon after their reference is dropped, but you can also close them explicitly to free their memory:

result.closeSync();

From DuckDB 2.0, a streaming result that hasn't been read to the end, or a pending result that hasn't been executed, blocks its connection: the next statement on it fails until the result is closed. A result reader or pending result can be closed the same way:

const reader = await connection.streamAndReadUntil(sql, 100);
reader.closeSync();
const rows = reader.getRows(); // rows already read stay available

Column names and types also stay available after closing; reading more rows throws.

The same applies to appenders: from DuckDB 2.0, an appender can't flush while its connection has such a result. Appenders flush on flushSync() and closeSync(), and automatically about every 204,800 rows, so with a streaming result open, appending fails at the next flush, and the rows appended since the last successful flush are lost. Read the result to the end or close it before appending, or append on a separate connection. Close appenders explicitly too: one that is flushed when it's garbage collected can't report a failure.

Inspect Result Metadata

Get column names and types:

const columnNames = result.columnNames();
const columnTypes = result.columnTypes();
Read Result Data

Run and read all data:

const reader = await connection.runAndReadAll('from test_all_types()');
const rows = reader.getRows();
// OR: const columns = reader.getColumns();

Stream and read up to (at least) some number of rows:

const reader = await connection.streamAndReadUntil(
  'from range(5000)',
  1000
);
const rows = reader.getRows();
// rows.length === 2048. (Rows are read in chunks of 2048.)

Read rows incrementally:

const reader = await connection.streamAndRead('from range(5000)');
reader.readUntil(2000);
// reader.currentRowCount === 2048 (Rows are read in chunks of 2048.)
// reader.done === false
reader.readUntil(4000);
// reader.currentRowCount === 4096
// reader.done === false
reader.readUntil(6000);
// reader.currentRowCount === 5000
// reader.done === true
Get Result Data

Result data can be retrieved in a variety of forms:

const reader = await connection.runAndReadAll(
  'from range(3) select range::int as i, 10 + i as n'
);

const rows = reader.getRows();
// [ [0, 10], [1, 11], [2, 12] ]

const rowObjects = reader.getRowObjects();
// [ { i: 0, n: 10 }, { i: 1, n: 11 }, { i: 2, n: 12 } ]

const columns = reader.getColumns();
// [ [0, 1, 2], [10, 11, 12] ]

const columnsObject = reader.getColumnsObject();
// { i: [0, 1, 2], n: [10, 11, 12] }
Convert Result Data

By default, data values that cannot be represented as JS built-ins are returned as specialized JS objects; see Inspect Data Values below.

To retrieve data in a different form, such as JS built-ins or values that can be losslessly serialized to JSON, use the JS or Json forms of the above result data methods.

Custom converters can be supplied as well. See the implementations of JSDuckDBValueConverter and JsonDuckDBValueConverters for how to do this.

Examples (using the Json forms):

const reader = await connection.runAndReadAll(
  'from test_all_types() select bigint, date, interval limit 2'
);

const rows = reader.getRowsJson();
// [
//   [
//     "-9223372036854775808",
//     "5877642-06-25 (BC)",
//     { "months": 0, "days": 0, "micros": "0" }
//   ],
//   [
//     "9223372036854775807",
//     "5881580-07-10",
//     { "months": 999, "days": 999, "micros": "999999999" }
//   ]
// ]

const rowObjects = reader.getRowObjectsJson();
// [
//   {
//     "bigint": "-9223372036854775808",
//     "date": "5877642-06-25 (BC)",
//     "interval": { "months": 0, "days": 0, "micros": "0" }
//   },
//   {
//     "bigint": "9223372036854775807",
//     "date": "5881580-07-10",
//     "interval": { "months": 999, "days": 999, "micros": "999999999" }
//   }
// ]

const columns = reader.getColumnsJson();
// [
//   [ "-9223372036854775808", "9223372036854775807" ],
//   [ "5877642-06-25 (BC)", "5881580-07-10" ],
//   [
//     { "months": 0, "days": 0, "micros": "0" },
//     { "months": 999, "days": 999, "micros": "999999999" }
//   ]
// ]

const columnsObject = reader.getColumnsObjectJson();
// {
//   "bigint": [ "-9223372036854775808", "9223372036854775807" ],
//   "date": [ "5877642-06-25 (BC)", "5881580-07-10" ],
//   "interval": [
//     { "months": 0, "days": 0, "micros": "0" },
//     { "months": 999, "days": 999, "micros": "999999999" }
//   ]
// }

These methods handle nested types as well:

const reader = await connection.runAndReadAll(
  'from test_all_types() select int_array, struct, map, "union" limit 2'
);

const rows = reader.getRowsJson();
// [
//   [
//     [],
//     { "a": null, "b": null },
//     [],
//     { "tag": "name", "value": "Frank" }
//   ],
//   [
//     [ 42, 999, null, null, -42],
//     { "a": 42, "b": "🦆🦆🦆🦆🦆🦆" },
//     [
//       { "key": "key1", "value": "🦆🦆🦆🦆🦆🦆" },
//       { "key": "key2", "value": "goose" }
//     ],
//     { "tag": "age", "value": 5 }
//   ]
// ]

const rowObjects = reader.getRowObjectsJson();
// [
//   {
//     "int_array": [],
//     "struct": { "a": null, "b": null },
//     "map": [],
//     "union": { "tag": "name", "value": "Frank" }
//   },
//   {
//     "int_array": [ 42, 999, null, null, -42 ],
//     "struct": { "a": 42, "b": "🦆🦆🦆🦆🦆🦆" },
//     "map": [
//       { "key": "key1", "value": "🦆🦆🦆🦆🦆🦆" },
//       { "key": "key2", "value": "goose" }
//     ],
//     "union": { "tag": "age", "value": 5 }
//   }
// ]

const columns = reader.getColumnsJson();
// [
//   [
//     [],
//     [42, 999, null, null, -42]
//   ],
//   [
//     { "a": null, "b": null },
//     { "a": 42, "b": "🦆🦆🦆🦆🦆🦆" }
//   ],
//   [
//     [],
//     [
//       { "key": "key1", "value": "🦆🦆🦆🦆🦆🦆" },
//       { "key": "key2", "value": "goose"}
//     ]
//   ],
//   [
//     { "tag": "name", "value": "Frank" },
//     { "tag": "age", "value": 5 }
//   ]
// ]

const columnsObject = reader.getColumnsObjectJson();
// {
//   "int_array": [
//     [],
//     [42, 999, null, null, -42]
//   ],
//   "struct": [
//     { "a": null, "b": null },
//     { "a": 42, "b": "🦆🦆🦆🦆🦆🦆" }
//   ],
//   "map": [
//     [],
//     [
//       { "key": "key1", "value": "🦆🦆🦆🦆🦆🦆" },
//       { "key": "key2", "value": "goose" }
//     ]
//   ],
//   "union": [
//     { "tag": "name", "value": "Frank" },
//     { "tag": "age", "value": 5 }
//   ]
// }

Column names and types can also be serialized to JSON:

const columnNamesAndTypes = reader.columnNamesAndTypesJson();
// {
//   "columnNames": [
//     "int_array",
//     "struct",
//     "map",
//     "union"
//   ],
//   "columnTypes": [
//     {
//       "typeId": 24,
//       "valueType": {
//         "typeId": 4
//       }
//     },
//     {
//       "typeId": 25,
//       "entryNames": [
//         "a",
//         "b"
//       ],
//       "entryTypes": [
//         {
//           "typeId": 4
//         },
//         {
//           "typeId": 17
//         }
//       ]
//     },
//     {
//       "typeId": 26,
//       "keyType": {
//         "typeId": 17
//       },
//       "valueType": {
//         "typeId": 17
//       }
//     },
//     {
//       "typeId": 28,
//       "memberTags": [
//         "name",
//         "age"
//       ],
//       "memberTypes": [
//         {
//           "typeId": 17
//         },
//         {
//           "typeId": 3
//         }
//       ]
//     }
//   ]
// }

const columnNameAndTypeObjects = reader.columnNameAndTypeObjectsJson();
// [
//   {
//     "columnName": "int_array",
//     "columnType": {
//       "typeId": 24,
//       "valueType": {
//         "typeId": 4
//       }
//     }
//   },
//   {
//     "columnName": "struct",
//     "columnType": {
//       "typeId": 25,
//       "entryNames": [
//         "a",
//         "b"
//       ],
//       "entryTypes": [
//         {
//           "typeId": 4
//         },
//         {
//           "typeId": 17
//         }
//       ]
//     }
//   },
//   {
//     "columnName": "map",
//     "columnType": {
//       "typeId": 26,
//       "keyType": {
//         "typeId": 17
//       },
//       "valueType": {
//         "typeId": 17
//       }
//     }
//   },
//   {
//     "columnName": "union",
//     "columnType": {
//       "typeId": 28,
//       "memberTags": [
//         "name",
//         "age"
//       ],
//       "memberTypes": [
//         {
//           "typeId": 17
//         },
//         {
//           "typeId": 3
//         }
//       ]
//     }
//   }
// ]
Infer JS Types from DuckDB Types

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @duckdb/node-api

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Frame 2085668439 (1)
Group 1261154229