New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

is-core-module

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-core-module

Is this specifier a node.js core module?

latest
Source
npmnpm
Version
2.17.0
Version published
Weekly downloads
110M
-0.32%
Maintainers
1
Weekly downloads
 
Created
Source

is-core-module Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version.

Example

var isCore = require('is-core-module');
var assert = require('assert');
assert(isCore('fs'));
assert(!isCore('butts'));

TypeScript

isCore accepts any string. isCore.Module is the union of every specifier in core.json, regardless of node version, so editors can suggest them.

The types import core.json, so resolveJsonModule, esModuleInterop, and allowSyntheticDefaultImports must be enabled; some module and moduleResolution settings enable them by default, but node16 does not enable resolveJsonModule. Without them, TypeScript reports an error in this package's index.d.ts, or, with skipLibCheck, isCore.Module silently widens to string | number | symbol.

import isCore = require('is-core-module');

function isBuiltin(specifier: string): boolean {
	return isCore(specifier); // any string is accepted
}

const name: isCore.Module = 'node:fs'; // only specifiers listed in `core.json`
isCore(name, '16.0.0'); // true

Tests

Clone the repo, npm install, and run npm test

Keywords

core

FAQs

Package last updated on 17 Sep 2026

Related posts