getExtensionPath (src/index.ts)

sqlite-sync · packages/node/src/index.ts · typescript · Apache-2.0
database, Database / ORM

Node/TS helper to locate SQLite Sync extension binary for current platform.

// Source: https://github.com/sqliteai/sqlite-sync | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { resolve } from 'node:path';
import { existsSync } from 'node:fs';
import { createRequire } from 'node:module';
import {
  getCurrentPlatform,
  getPlatformPackageName,
  getBinaryName,
  type Platform
} from './platform.js';

// Create a require function that works in both CommonJS and ESM
const require = createRequire(import.meta.url);

/**
 * Error thrown when the SQLite Sync extension cannot be found
 */
export class ExtensionNotFoundError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'ExtensionNotFoundError';
  }
}

/**
 * Attempts 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key