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

@nodetool-ai/nodes-utils

v0.8.1

Published

Shared helpers for node packages: platform tags and lazy Node-only module loaders

Readme

@nodetool-ai/nodes-utils

Shared helpers for node packages: platform tags and lazy Node-only module loaders for NodeTool.

A small utility crate every *-nodes package depends on instead of duplicating helpers or pulling the whole base-nodes barrel: platform-tagging helpers that stamp static platforms onto node arrays, lazy loaders for node: built-ins so non-portable paths don't block module init on non-Node runtimes, template variable substitution, Buffer-free base64, and the destination rules every Save*File node shares.

Install

npm install @nodetool-ai/nodes-utils

Exported symbols

| Symbol | Kind | Description | | --- | --- | --- | | tagAsServer | function | Mark a _NODES array as server-only | | tagAsNode | function | Mark nodes as requiring the Node runtime | | tagAsHybrid | function | Mark nodes as running on server or browser | | tagAsBrowserGpu | function | Mark nodes as needing browser WebGPU | | tagAsUniversal | function | Mark nodes as runnable on any platform | | tagAsContentCard | function | Tag nodes surfaced as content cards | | loadNodeFsPromises | function | Lazily import node:fs/promises | | loadNodeFsSync | function | Lazily import node:fs | | loadNodePath | function | Lazily import node:path | | loadNodeOs | function | Lazily import node:os | | loadNodeUrl | function | Lazily import node:url | | renderTemplate | function | Substitute {{ variable }} / {variable} placeholders | | referencedVariables | function | List variable names referenced in a template | | base64ToBytes | function | Decode base64 to Uint8Array (Node + browser) | | bytesToBase64 | function | Encode bytes to base64 (Node + browser) | | resolveSaveTarget | function | Folder + filename → an absolute path, directory created, name numbered on collision | | resolveSaveFolder | function | Pick the workspace folder or the node's own folder property | | uniqueFilePath | function | name.ext → name_1.ext, name_2.ext, … past what is already there | | folderPathOf | function | Read a folder property (path, file:// URI or folder ref) | | SAVE_TO_WORKSPACE_TITLE | const | Title every save node shows on the workspace toggle | | SAVE_TO_WORKSPACE_DESCRIPTION | const | Description every save node shows on the workspace toggle | | VISIBLE_WHEN_NOT_SAVING_TO_WORKSPACE | const | json_schema_extra (visible_when) that shows the folder field only while the toggle is off |

Usage

import {
  tagAsServer,
  renderTemplate,
  loadNodePath
} from "@nodetool-ai/nodes-utils";

tagAsServer(_NODES);

const text = renderTemplate("Hello {{ name }}", { name: "world" });

// Only touches node:path when this path actually runs
const path = await loadNodePath();
const full = path.join(dir, "file.txt");

Saving a file from a node

// Writes into the run's workspace folder while `save_to_workspace` is on, and
// numbers the name (`out_1.png`) rather than overwriting what is there.
const target = await resolveSaveTarget({
  folder: this.folder,
  filename: dateName(String(this.filename || "out.png")),
  saveToWorkspace: this.save_to_workspace,
  workspaceDir: context?.workspaceDir
});

Links