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

@gaubee/node

v0.4.0

Published

一些常见的nodejs-js工具函数

Downloads

53

Readme

中文 / English

@gaubee/node

This project provides further supplements related to Node.js APIs based on @gaubee/util.

How to use

Install

# pnpm
pnpm add @gaubee/node
# npm
npm install @gaubee/node
# yarn
yarn add @gaubee/node
# jsr
deno add @gaubee/node

Usage

import { cwdResolver } from "@gaubee/node/path";

console.log(cwdResolver("file.txt"));

API

env

  • viteEnvSource:
    • (): Record<string, string>
    • Gets the Vite environment variable source.
  • nodeEnvSource:
    • (): Record<string, string>
    • Gets the Node.js environment variable source (process.env).
  • denoEnvSource:
    • (): Record<string, string>
    • Gets the Deno environment variable source.
  • bunEnvSource:
    • (): Record<string, string>
    • Gets the Bun environment variable source.
  • storageEnvSource:
    • (storage?: Storage): Record<string, string>
    • Gets an environment variable source based on the Storage API (e.g., sessionStorage).
  • autoEnvSource:
    • (fallback?: () => Record<string, string>): Record<string, string | undefined>
    • Automatically detects and returns the environment variable source for the current environment (Deno > Bun > Vite > Node.js > sessionStorage).
  • defineEnv:
    • <P extends string, KV extends Record<string, EnvConfig>>(prefix: P, kv: KV, source?: Record<string, string | undefined>, ext?: object): DefineEnvChain<P, DefineEnv<P, KV>>
    • Defines a set of environment variables, supporting type conversion, default values, and chained definitions.

path

  • normalizeFilePath:
    • (path: string | URL): string
    • Formats the path to standard POSIX format, supporting URL and Windows paths.
  • createResolver:
    • (cwd: string): PathResolver
    • Creates a path resolver that resolves paths relative to the specified cwd (current working directory).
    • The returned function has a dirname property with the value of the passed cwd.
  • cwdResolver:
    • PathResolver (i.e., ((...paths: string[]) => string) & {dirname: string})
    • A path resolver based on the current Node.js process's working directory (process.cwd()).
  • createResolverByRootFile:
    • (fromPath?: string | URL, rootFilename?: string): PathResolver
    • Creates a path resolver by looking up the specified root filename (defaults to package.json) upwards. The resolver will resolve paths based on the directory containing that root file.

promise

  • nodeTimmers:
    • { eventEmitter: NodeTimmer.EventEmiter }
    • An extension to timmers in @gaubee/util, providing Timmer related to Node.js events.
    • nodeTimmers.eventEmitter: A Timmer factory function for creating Timers based on node:events/EventEmitter for the delay function. It can listen for specified events and resolve the Promise when the event is triggered, with optional support for event argument filters.