tekir
All Packages
Corev0.1.8

@tekir/runtime

Cross-runtime abstraction layer. File ops, SQLite, server, hashing. Works on Bun and Node.js.

Installation

$bun add @tekir/runtime

Features

  • Runtime detection: isBun(), isNode(), runtimeName()
  • File operations: read, write, stat, exists, fileResponse
  • SQLite via openDatabase() on both Bun and Node.js
  • Password hashing: bcrypt and argon2 across runtimes
  • Cross-runtime serve() and spawn()

Quick Example

TypeScript
import { isBun, readFileText, openDatabase } from '@tekir/runtime'

console.log('Running on Bun:', isBun())

const content = await readFileText('config.json')
const db = openDatabase('app.db')

Changelog

v0.1.8LatestSeptember 16, 2026
  • Runtime adapters now provide portable Node fallbacks for server, filesystem, password, process, garbage-collection, and SQLite operations.
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.7August 22, 2026
  • The Node.js HTTP fallback now returns an awaitable shutdown promise, stops accepting new connections before cleanup and waits for active requests to finish. Forced shutdown also closes active Node.js connections immediately, matching the Bun server contract.
v0.1.6July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.5July 16, 2026
  • The Node HTTP adapter streams response bodies instead of buffering them and preserves multiple Set-Cookie headers correctly across runtime boundaries.
v0.1.4June 13, 2026
  • The Node server now streams response bodies chunk by chunk (with backpressure and client-disconnect aborts) instead of buffering the whole body into memory first.
  • serve() gained maxRequestBodySize (default 10 MB) and idleTimeout (default 120 s) on both runtimes. On Node, oversize requests are rejected with a 413 during accumulation, and request/header timeouts are set.
  • fileResponse() accepts an optional baseDir and rejects ../ escapes; MIME types are now detected consistently on both runtimes. openDatabase() skips WAL on read-only opens.
  • readFile/readFileText now produce a consistent error carrying code: 'ENOENT' and the path on both runtimes. Runtime detection now verifies process.versions.node and throws a clear error when neither Bun nor Node is detected.
  • Found and fixed with Fable.
v0.1.3May 3, 2026
  • readDir(path) and readDirRecursive(path, options) list directory contents across runtimes. The recursive walker uses Bun.Glob on Bun and falls back to a depth-first node:fs/promises walk on Node. Skips node_modules, .git, and dotfiles by default; pass extensions to filter by suffix and ignore to widen the skip list.
v0.1.2May 2, 2026
  • Header conversion no longer requires the DOM.Iterable lib in the consumer's tsconfig. Replaced the Headers.entries() call in the Node.js server adapter with Headers.forEach, which is part of plain DOM.
v0.1.1April 27, 2026
  • openDatabase() now creates missing parent directories automatically. A path like './database/app.sqlite' works on a fresh project even when no database/ folder exists yet.
v0.1.0April 1, 2026
  • Initial release

Other Core packages