Skip to content

prachaquant/51degrees.node

 
 

Repository files navigation

51degrees.node Build Status

51degrees c-sdk native bindings for nodejs, it help you detect devices from userAgent in high performance.

NPM NPM

API

.parse(userAgent[, method, options])
  • method must be one of pattern and trie, default value is: pattern.

  • options must be an object

  • options.filename: your 51degrees data, lite or premium

  • options.properties: required properties

for more information, you could move to 51degrees documentation

Usage

var parse = require('51degrees').parse;
var userAgent = '...' // your userAgent in any clients(browser/ios/android)
var ret = parse(userAgent, 'trie');
console.log(ret);

After the above program, you will get:

{ Id: '17595-21721-21635-18092',
  Canvas: true,
  CssTransforms: true,
  CssTransitions: true,
  History: true,
  Html5: true,
  IndexedDB: true,
  IsMobile: false,
  Json: true,
  PostMessage: true,
  Svg: true,
  TouchEvents: true,
  WebWorkers: true,
  method: 'trie',
  data: {} }
.ALL_PROPERTIES

51Degrees.node exposure ALL_PROPERTIES to shortly fetch all propertites from userAgent, just using like this:

var parse = require('51degrees').parse;
var properties = require('51degrees').ALL_PROPERTIES;
var userAgent = '...' // your userAgent in any clients(browser/ios/android)
var ret = parse(userAgent, 'trie', {properties: properties});
console.log(ret);

Then will prints the whole properties, it's super useful for overview of this module and 51Degrees product.

Properties

The following list shows all properties that 51degrees would export in json:

  • AnimationTiming
  • BlobBuilder
  • Canvas
  • CssBackground
  • CssBorderImage
  • CssCanvas
  • CssColor
  • CssColumn
  • CssFlexbox
  • CssFont
  • CssImages
  • CssMediaQueries
  • CssMinMax
  • CssOverflow
  • CssPosition
  • CssText
  • CssTransforms
  • CssTransitions
  • CssUI
  • DataSet
  • DataUrl
  • DeviceOrientation
  • FileReader
  • FileSaver
  • FileWriter
  • FormData
  • Fullscreen
  • GeoLocation
  • History
  • Html5
  • Html-Media-Capture
  • Id
  • Iframe
  • IndexedDB
  • IsMobile
  • Json
  • LayoutEngine
  • Masking
  • PostMessage
  • Progress
  • Prompts
  • ScreenPixelsHeight
  • ScreenPixelsWidth
  • Selector
  • Svg
  • TouchEvents
  • Track
  • Video
  • Viewport
  • WebWorkers
  • Xhr

Installation

$ npm install 51degrees --save

License

MPL

About

51degrees c-sdk native bindings for nodejs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 92.6%
  • C++ 3.5%
  • JavaScript 3.5%
  • Python 0.4%