
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@socketsecurity/lib
Advanced tools
Core infrastructure library for Socket.dev security tools. Provides utilities for file system operations, process spawning, HTTP requests, environment detection, logging, spinners, and more.
Node.js 22 or higher is required.
# Using pnpm (recommended)
pnpm add @socketsecurity/lib
# Using npm
npm install @socketsecurity/lib
# Using yarn
yarn add @socketsecurity/lib
import { Spinner } from '@socketsecurity/lib/spinner'
import { getDefaultLogger } from '@socketsecurity/lib/logger'
import { readJson } from '@socketsecurity/lib/fs'
const logger = getDefaultLogger()
const spinner = Spinner({ text: 'Loading package.json...' })
spinner.start()
const pkg = await readJson('./package.json')
spinner.successAndStop('Loaded successfully')
logger.success(`Package: ${pkg.name}@${pkg.version}`)
Spinners, colored loggers, themes, progress bars, and terminal output formatting.
Spinner - Animated CLI spinners with progress trackinggetDefaultLogger() - Colored console logger with symbolsLOG_SYMBOLS - Colored terminal symbols (✓, ✗, ⚠, ℹ, →)setTheme() - Customize colors across the libraryCross-platform file operations with safe deletion and convenient wrappers.
readFileUtf8(), readFileBinary() - Read files as text or binaryreadJson(), writeJson() - Parse and format JSON filessafeDelete() - Protected deletion with safety checksfindUp(), findUpSync() - Traverse up to find filessafeMkdir() - Create directories without EEXIST errorsvalidateFiles() - Check file readability (useful for Yarn PnP, pnpm)Native Node.js HTTP/HTTPS requests with retry logic and redirects.
httpJson() - Fetch and parse JSON from APIshttpText() - Fetch text/HTML contenthttpDownload() - Download files with progress callbackshttpRequest() - Full control over requests and responsesSpawn child processes safely with cross-platform support.
spawn() - Promise-based process spawning with output capturespawnSync() - Synchronous version for blocking operations.cmd/.bat handlingProcessLock - Ensure only one instance runs at a timesetupIPC() - Inter-process communicationType-safe environment variable access and platform detection.
getCI() - Detect CI environmentgetNodeEnv() - Get NODE_ENV valueisTest() - Check if running testsgetHome() - Home directory (Unix/Linux/macOS)setEnv(), resetEnv()Detect and work with npm, pnpm, and yarn.
detectPackageManager() - Identify package manager from lock filesPre-defined values for Node.js, npm, and platform detection.
getNodeMajorVersion() - Get current Node.js major versionWIN32, DARWIN - Platform booleans (use !WIN32 && !DARWIN for Linux)getAbortSignal() - Global abort signalHelpers for arrays, objects, strings, promises, sorting, and more.
import { spawn } from '@socketsecurity/lib/spawn'
const result = await spawn('git', ['status'])
console.log(result.stdout)
import { httpJson } from '@socketsecurity/lib/http-request'
const data = await httpJson('https://api.example.com/data')
import { Spinner } from '@socketsecurity/lib/spinner'
const spinner = Spinner({ text: 'Processing...' })
spinner.start()
// ... do work ...
spinner.successAndStop('Complete!')
import { safeDelete } from '@socketsecurity/lib/fs'
// Protected against deleting parent directories
await safeDelete('./build')
Module not found: Verify you're importing from the correct path:
// Correct
import { Spinner } from '@socketsecurity/lib/spinner'
// Wrong
import { Spinner } from '@socketsecurity/lib'
Node version error: This library requires Node.js 22+. Check your version:
node --version
For more issues, see the Troubleshooting Guide.
pnpm install # Install dependencies
pnpm build # Build the library
pnpm test # Run tests
pnpm run cover # Run tests with coverage
pnpm dev # Watch mode
pnpm run lint # Check code style
pnpm run fix # Fix formatting issues
Contributions are welcome! Please read the CLAUDE.md file for development guidelines and coding standards.
MIT
FAQs
Core utilities and infrastructure for Socket.dev security tools
The npm package @socketsecurity/lib receives a total of 18,961 weekly downloads. As such, @socketsecurity/lib popularity was classified as popular.
We found that @socketsecurity/lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.