Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-device-detector

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-device-detector

detect device device type:mobile,tablet,os,brand,model

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-9.09%
Maintainers
1
Weekly downloads
 
Created
Source

node-device-detector

port phplib piwik/device-detector from nodejs

library works only under nodejs v10+

Install

local install production

npm install node-device-detector --production

local machine install is developer

npm install node-device-detector --only=dev

Usage

const DeviceDetector = require('node-device-detector');

let userAgent = 'Mozilla/5.0 (Linux; Android 5.0; NX505J Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36';
let detector = new DeviceDetector;

console.log(detector.detect(userAgent));

Result parse

{ 
    device: { brand: 'ZTE', model: 'Nubia Z7 max', type: 'smartphone' },
    os: { name: 'Android', version: '5.0' },
    browser: { name: 'Chrome Mobile', version: '43.0.2357.78' } 
}

Keywords

FAQs

Package last updated on 30 May 2018

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