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

@apilayer/userstack

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apilayer/userstack

Userstack provides an API to Detect any Browser, Device & OS in Real-Time

  • 0.1.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

userstack-js

Userstack provides an API to Detect any Browser, Device & OS in Real-Time

Installation

Using npm

npm install --save @apilayer/userstack

or yarn

yarn add @apilayer/userstack

Getting Started

Head over to Userstack and create an account. Copy access key from dashboard.

import userstack from '@apilayer/userstack'

const useHTTPs = false
const layer = new userstack("<your-access-key>", useHTTPs)

detect

detect Look up any given User-Agent string.

Signature:

detect(ua: string): Promise<Response>

Example:

const response = layer.detect("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36")

console.log('response:', response)

Response:

{
  ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
  type: "browser",
  brand: "Apple",
  name: "Mac",
  url: "https://www.google.com/about/company/",
  os: {
    name: "macOS 10.14 Mojave",
    code: "macos_10_14",
    url: "https://en.wikipedia.org/wiki/MacOS_Mojave",
    family: "macOS",
    family_code: "macos",
    family_vendor: "Apple Inc.",
    icon: "https://assets.userstack.com/icons/os/macosx.png",
    icon_large: "https://assets.userstack.com/icons/os/macosx_big.png"
  },
  device: {
    is_mobile_device: false,
    type: "desktop",
    brand: "Apple",
    brand_code: "apple",
    brand_url: "http://www.apple.com/",
    name: "Mac"
  },
  browser: {
    name: "Chrome",
    version: "71.0.3578.98",
    version_major: "71",
    engine: "WebKit/Blink"
  },
  crawler: {
    is_crawler: false,
    category: null,
    last_seen: null
  }
}

BulkDetect

BulkDetect Look up multiple User-Agent strings in bulk.

Signature:

bulkDetect(ua_batch: string[]): Promise<Response[]>

Example:

const response = layer.bulkDetect([
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
])

console.log('response:', response)

Response:

[{
  ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
  type: "browser",
  brand: "Apple",
  name: "Mac",
  url: "https://www.google.com/about/company/",
  os: {
    name: "macOS 10.14 Mojave",
    code: "macos_10_14",
    url: "https://en.wikipedia.org/wiki/MacOS_Mojave",
    family: "macOS",
    family_code: "macos",
    family_vendor: "Apple Inc.",
    icon: "https://assets.userstack.com/icons/os/macosx.png",
    icon_large: "https://assets.userstack.com/icons/os/macosx_big.png"
  },
  device: {
    is_mobile_device: false,
    type: "desktop",
    brand: "Apple",
    brand_code: "apple",
    brand_url: "http://www.apple.com/",
    name: "Mac"
  },
  browser: {
    name: "Chrome",
    version: "71.0.3578.98",
    version_major: "71",
    engine: "WebKit/Blink"
  },
  crawler: {
    is_crawler: false,
    category: null,
    last_seen: null
  }
}]

License

MIT

FAQs

Package last updated on 01 Oct 2019

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