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

@igorskyflyer/regkeys

v3.0.2

Published

๐Ÿ“š A package for fetching Windows registry keys. ๐Ÿ—

Readme

๐Ÿ“ƒ Table of Contents

๐Ÿค– Features

  • ๐Ÿ” Enumerates Windows Registry subkeys via the native reg.exe command
  • ๐Ÿ—‚ Automatically expands short hive names to their full forms
  • โšก Supports both synchronous and asynchronous usage patterns
  • ๐Ÿง  Caches retrieved keys for faster repeated lookups, with optional refresh
  • โœ… Checks for the existence of single or multiple registry keys
  • ๐ŸŽฏ Allows custom predicateโ€‘based key matching
  • ๐Ÿ”ก Offers optional caseโ€‘sensitive matching
  • โ™ป๏ธ Provides a way to clear cached results
  • ๐Ÿ–ฅ Ensures execution only on Windows systems
  • ๐Ÿ”ง Includes static variables for easier hives referencing

๐Ÿ•ต๐Ÿผ Usage

Install it by executing:

npm i @igorskyflyer/regkeys

๐Ÿคน๐Ÿผโ€โ™‚๏ธ API

constructor()

constructor(key): RegKeys

Creates the RegKeys object. Do not forget to set the key parameter.

  • key: string, the key you later want to manipulate with, i.e. read keys, check for children keys, etc.,

key can either be an expanded or a non-expanded key, i.e.:

| Non-expanded | Expanded | | :----------: | :------------------------: | | HKCR | HKEY_CLASSES_ROOT | | HKCU | HKEY_CURRENT_USER | | HKLM | HKEY_LOCAL_MACHINE | | HKU | HKEY_USERS | | HKCC | HKEY_CURRENT_CONFIGURATION |

returns the RegKeys object.

Example
import { RegKeys } from '@igorskyflyer/regkeys'

// for your convenience, you can use forward slashes,
// since internally Windows only supports back slashes,
// which need to be escaped and look bad ๐Ÿ˜ซ๐Ÿ˜’

// so...
// ๐Ÿ˜’
const registry: RegKeys = new RegKeys('HKLM\\Software')

// is the same as

// ๐Ÿฅณ๐ŸŽŠ
const registry: RegKeys = new RegKeys('HKLM/Software')

get()

get(forceRefresh: boolean = false): string[]

Gets the keys for the given root key.

  • forceRefresh: boolean, indicates whether the registry should be queried again since the result of this method is cached internally, for performance,

returns a string[].

Example
import { RegKeys } from '@igorskyflyer/regkeys'

const registry: RegKeys = new RegKeys('HKCR')
const keys: string[] = registry.get()

// do something with the keys,
// it's your fate, unlock it ๐Ÿ˜›
keys.forEach((key: string) => {
  console.log(key)
})

hasKey()

hasKey(searchFor: string, caseSensitive: boolean = false): boolean

Checks whether the given key is a direct child of the currently selected key.

  • searchFor: string, the key to search for,
  • caseSensitive: boolean, indicates whether the search should be case-sensitive or not. Defaults to false,

returns a boolean.

NOTE: it will auto-fetch the keys if the internal cache is empty = you didn't call get() before calling this method.

Example
import { RegKeys } from '@igorskyflyer/regkeys'

const registry: RegKeys = new RegKeys('HKLM/Software')

// let's see if we have any
// Microsoft software on our Windows PC
// ๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚
console.log(registry.hasKey('Microsoft'))

hasKeys()

hasKeys(searchFor: string[], caseSensitive: boolean = false): boolean

Checks whether the given keys are a direct child of the currently selected key.

  • list: string[], the keys to search for,
  • caseSensitive: boolean, indicates whether the search should be case-sensitive or not. Defaults to false,

returns a boolean[].

NOTE: it will auto-fetch the keys if the internal cache is empty = you didn't call get() before calling this method.

Example
import { RegKeys } from '@igorskyflyer/regkeys'

const registry: RegKeys = new RegKeys('HKLM/Software')

console.log(registry.hasKeys(['Microsoft', 'Macromedia', 'Google', 'Adobe']))

has()

has(value: string|string[], caseSensitive: boolean = false): boolean|boolean[]

A generic method that checks whether the given key(s) is/are a direct child of the currently selected key. See both hasKey() and hasKeys(). You can use this method for own convenience, it will pick the suited method depending on the type of the value parameter,

  • value: string|string[], the key(s) to search for,
  • caseSensitive: boolean, indicates whether the search should be case-sensitive or not. Defaults to false,

returns a boolean|boolean[].

NOTE: it will auto-fetch the keys if the internal cache is empty = you didn't call get() before calling this method.

Example
import { RegKeys } from '@igorskyflyer/regkeys'

const registry: RegKeys = new RegKeys('HKLM/Software')

console.log(registry.has('Microsoft'))
console.log(registry.has(['Microsoft', 'Macromedia', 'Google', 'Adobe']))

searchFor()

searchFor(value: string, predicate: SearchPredicate): boolean

Provides a way to do keys-checking using a custom predicate function,

  • value: string, the key name to find,
  • predicate: SearchPredicate, the callback that will do the actual querying, see the code example below,

returns a boolean, i.e. true upon finding the first match or false if no match is found or any of the both required parameters aren't set.

NOTE: it will auto-fetch the keys if the internal cache is empty = you didn't call get() before calling this method.

Example
import { RegKeys } from '@igorskyflyer/regkeys'

const registry: RegKeys = new RegKeys('HKLM/Software')

// useful for custom search algorithms/behavior,
// like demonstrated here, case-insensitive partial search
console.log(
  registry.searchFor('micro', (key: string, searchFor: string, i: number) => {
    return key.toLowerCase().indexOf(searchFor.toLowerCase()) > -1
  })
)

clear()

clear(): void

Clears the cached result, if any,

returns a void.

Example
import { RegKeys } from '@igorskyflyer/regkeys'

const registry: RegKeys = new RegKeys('HKLM/Software')

// fetch keys and cache them
let keys = registry.get()

// ๐Ÿ”ฎ do something with the registry โญ

// clear the cached result
registry.clear()

// refetch (new) keys
keys = registry.get()

console.log(keys)

๐Ÿ“ Changelog

๐Ÿ“‘ The changelog is available here, CHANGELOG.md.

๐Ÿชช License

Licensed under the MIT license which is available here, MIT license.

๐Ÿ’– Support

๐Ÿงฌ Related

@igor.dvlpr/is-rootdir

๐Ÿ”ผ Provides a way to check if the given path is the root drive/directory. โ›”

@igor.dvlpr/mp3size

๐Ÿงฎ Calculates an estimated file size of Mp3 files. ๐ŸŽถ

@igor.dvlpr/aria

๐Ÿงฌ Meet Aria, an efficient Adblock filter list compiler, with many features that make your maintenance of Adblock filter lists a breeze! ๐Ÿ—ก

@igor.dvlpr/keppo

๐ŸŽก Parse, manage, compare and output SemVer-compatible version numbers. ๐Ÿ›ก

@igor.dvlpr/simple-exec

๐Ÿ•บ Command. Execution. Made. Simple. โ–ถ

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Author

Created by Igor Dimitrijeviฤ‡ (@igorskyflyer).