Skip to content
0

katanakit-js / useIsNode

Function: useIsNode() ​

ts
function useIsNode(): boolean;

Defined in: src/infrastructure/filesystem/path.service.ts:27

Checks whether the code runs in a Node.js-compatible runtime (Node, Bun or Deno). Returns false in browsers and edge runtimes.

Returns ​

boolean

true when process.versions.node is available.

Example ​

ts
import { useIsNode } from "katanakit-js";

if (useIsNode()) {
  // safe to use node:fs / node:path
}

Released under the MIT License.