default-user-agent
raw JSON → 1.0.0 verified Sat Apr 25 auth: no javascript maintenance
Generates a default User-Agent string for Node.js HTTP requests. Version 1.0.0 is stable but unmaintained since 2015. It outputs strings like 'Node.js/<version> (<os>; <arch>)' and accepts optional app name and version (e.g., 'urllib/0.0.1 Node.js/...'). Unlike modern packages like 'useragent' or 'ua-parser-js', it only generates a string and has no parsing capabilities. Works with Node >=0.10.0. No releases or updates in the last 9 years.
Common errors
error Cannot find module 'default-user-agent' ↓
cause Package not installed or not in node_modules.
fix
Run 'npm install default-user-agent' to install it.
error TypeError: ua is not a function ↓
cause Incorrect import pattern, e.g., using import default export in ESM project incorrectly.
fix
Use CommonJS require: const ua = require('default-user-agent');
Warnings
deprecated Package has no releases since 2015; issues and pull requests not addressed. ↓
fix Consider using a maintained alternative like 'useragent' or manually constructing the User-Agent string.
breaking In Node.js versions older than 0.10.0, the package may not work due to engine requirement. ↓
fix Upgrade Node.js to >=0.10.0.
Install
npm install default-user-agent yarn add default-user-agent pnpm add default-user-agent Imports
- default wrong
import ua from 'default-user-agent';correctconst ua = require('default-user-agent');
Quickstart
const ua = require('default-user-agent');
// Generate default user-agent
console.log(ua()); // e.g., 'Node.js/14.17.0 (OS X 10.15; x64)'
// Generate with custom app name and version
console.log(ua('myapp', '1.2.3')); // 'myapp/1.2.3 Node.js/14.17.0 (OS X 10.15; x64)'