npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

51degrees

v1.8.1

Published

51degrees c-sdk native bindings for nodejs

Downloads

161

Readme

51degrees.node

![Gitter](https://badges.gitter.im/Join Chat.svg)

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

NPM NPM

Windows | Mac/Linux
-------------- | ------------ Build status | Build Status

API

.Parse(filename[, properties, options])
  • filename {String} your 51degrees data, lite or premium.

  • properties {Array} optional, required properties

  • options {Object}

  • options.autoUpdate {Boolean} enable/disable autoUpdate feature

  • options.key {String} auto-update requires a licesen key from 51Degrees

  • options.interval {Integer}, default value 30 * 60 * 1000 (half hours)

  • options.onupdated {Function} if auto updated, you will get call at this function

for more information, you could move to 51degrees documentation

parser.parse(userAgent)
  • userAgent {String}

parse the userAgent given by you, and return result of that.

Usage

var Parser = require('51degrees').Parser;
var psr = new Parser('51Degrees-Lite.dat');
var userAgent = '...'; // your userAgent in any clients(browser/ios/android)
var ret = psr.parse(userAgent);
console.log(ret);
Create an auto-updated pattern parser
var psr = new Parser('51Degrees-Lite.dat', [], {
  autoUpdate: true,
  key: 'your license key'
});

Note: this feature only is used at pattern data.

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 properties = require('51degrees').ALL_PROPERTIES;
var userAgent = '...' // your userAgent in any clients(browser/ios/android)
var psr = new Parser('51Degrees-Lite.trie', properties);
var ret = psr.parse(userAgent);
console.log(ret);

Then will print 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