npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@google-cloud/spannerlib-node-win32-x64

v0.2.0

Published

Internal Node-API wrapper for Cloud Spanner spannerlib. This is an internal package intended for Google Cloud Spanner Node drivers and may introduce breaking changes without prior notice.

Readme

Node-API Wrapper for Spanner Shared Library

NOTICE: This is an internal library intended for use by Google Cloud Spanner driver packages (such as the high-level Node.js Spanner driver). It is not intended for direct use by end customers and can introduce breaking changes without prior notice.

Prerequisites

  • Node.js >= 20.0.0
  • Go compiler (to build the underlying shared library, if not pre-built)
  • C++ toolchain (GCC/Clang or MSVC)

Installation & Building

To build the native addon and compile the driver for development, run:

npm install

For a comprehensive architectural breakdown of the 3-layer compilation pipeline (Go Link, C++ node-gyp bridge, and Dual-publishing ESM/CJS), refer to the BUILD_AND_RELEASE.md documentation.

Usage

const { Pool, Connection } = require('spannerlib-node');

async function run() {
    const pool = await Pool.create(connectionString);
    
    const conn = await pool.createConnection();
    const rows = await conn.executeSql('SELECT 1');
    
    while (await rows.next()) {
        // process rows
    }
    
    await rows.close();
    await conn.close();
    await pool.close();
}

Architecture

The wrapper consists of:

  1. src/cpp/addon.cc: C++ Node-API bridge that handles thread boundaries and type conversions between V8 and C.
  2. src/ffi/utils.ts: Helper functions to invoke native methods asynchronously using Promises.
  3. src/lib/: JavaScript classes (Pool, Connection, Rows) that provide a clean object-oriented interface.

Component Interaction

The wrapper operates by executing calls through the low-level native bridge (addon.cc). The user-facing classes (Pool, Connection, Rows) in the lib folder map execution requests into Protobuf payloads and pass them to the bridge via the asynchronous dispatcher in utils.ts. Each successful execution returns memory ID handles that are tracked inside the singleton state registry (spannerlib.ts) to link native garbage collection triggers.

Component Interaction & Memory Management

When a JavaScript object (like a Pool or Connection) is created, it holds an ID referencing a pinned Go object in memory. The spannerLib singleton maintains a FinalizationRegistry. This registry allows Node.js to listen for when the JavaScript object is garbage collected. When GC occurs, the registry automatically triggers a cleanup call to the native layer to release the corresponding Go object, preventing native memory leaks even if the developer forgets to call .close() explicitly.