Socket
Socket
Sign inDemoInstall

useragent

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

useragent

User-Agent string parser based on Browserscope.org algorithms for more browser reporting


Version published
Weekly downloads
539K
decreased by-16.9%
Maintainers
1
Weekly downloads
 
Created

What is useragent?

The 'useragent' npm package is used to parse and identify user agent strings. It helps in detecting the browser, version, operating system, and device type from a given user agent string.

What are useragent's main functionalities?

Parsing User Agent Strings

This feature allows you to parse a user agent string and get a readable format of the browser, version, and operating system.

const useragent = require('useragent');
const agent = useragent.parse('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
console.log(agent.toString());

Detecting Browser

This feature allows you to detect the browser family from a user agent string.

const useragent = require('useragent');
const agent = useragent.parse('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
console.log(agent.family);

Detecting Operating System

This feature allows you to detect the operating system from a user agent string.

const useragent = require('useragent');
const agent = useragent.parse('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
console.log(agent.os.toString());

Detecting Device Type

This feature allows you to detect the device type from a user agent string.

const useragent = require('useragent');
const agent = useragent.parse('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
console.log(agent.device.toString());

Other packages similar to useragent

Keywords

FAQs

Package last updated on 02 Apr 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc