Check out the latest documentation.

Configuring the Node.js API

Before you start matching User-Agents, you may wish to configure the solution to use a different database for example. The config json object is where all the settings can be changed, it is also possible to initialise the provider a path to a .json file in the same format.

The most basic example using just a data file can be seen below:

// Use Lite data via package.
var litePattern = require('fiftyonedegreeslitepattern');
var liteTrie = require('fiftyonedegreeslitetrie');

// Or use Premium/Enterprise data via the its path.
var premiumPattern = "/path/to/51Degrees.dat";
var premiumTrie = "/path/to/51Degrees.trie";
var config = {"dataFile" : litePattern};
var provider = new fiftyonedegreescore(config);

Setting Default Description
General Settings
dataFile fiftyonedegreeslitepattern package String. Path to a Pattern or Trie database file.
properties '' String. Comma separated list of case-sensitive property names to be fetched on every device detection. Leave empty to fetch all available properties.
License '' String. Your 51Degrees license key. This is required if you want to set up the automatic package updates.
Pattern Detector Settings
cacheSize 10000 Integer. Sets the size of the workset cache.
poolSize 20 Integer. Sets the size of the workset pool.
UsageSharingEnabled True Boolean. Indicates if usage data should be shared with We recommended leaving this value unchanged to ensure we're improving the performance and accuracy of the solution. If this is enabled, you may need to allow HTTPS traffic to the 51Degrees address.
setGetters True Boolean. Indicates whether getters are set for the match object so that match.IsMobile can be used in place of match.getValue('IsMobile'). This makes things simpler when using properties that can return an array of values.
stronglyTyped True Boolean. Indicates whether the match getters return boolean values as a string (True/False) or a boolean type (true/false).