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

real-user-agent

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

real-user-agent - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

4

index.js

@@ -10,3 +10,3 @@ module.exports = () => all().then(d => d.shift());

const count = 10; // how many user agents (10)
const fallbackString = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36';
const fallback = require('./ua');
const https = require('https');

@@ -66,3 +66,3 @@

console.error(err);
data = Array.from(Array(count)).map(() => fallbackString);
data = fallback;
}

@@ -69,0 +69,0 @@ }

{
"name": "real-user-agent",
"version": "2.0.1",
"version": "2.0.2",
"description": "get a real user-agent string sourced from top 10 current",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,3 @@ # real-user-agent

Get an up-to-date user-agent string, sourced from the [most common user agents](https://techblog.willshouse.com/2012/01/03/most-common-user-agents/). To avoid each use of this module hammering the source, the data is now self-hosted in this repository, [available via cdn](https://cdn.jsdelivr.net/gh/fijimunkii/real-user-agent@master/ua.json). A simple local cache, invalidated every 2 hours, prevents extra requests. A data cap is implemented in the request. There is a fallback string in case the data is corrupt or host is unreachable.
Get an up-to-date user-agent string, sourced from the [most common user agents](https://techblog.willshouse.com/2012/01/03/most-common-user-agents/). To avoid each use of this module hammering the source, the data is now self-hosted in this repository, [available via cdn](https://cdn.jsdelivr.net/gh/fijimunkii/real-user-agent@master/ua.json). A simple local cache, invalidated every 2 hours, prevents extra requests. A data cap is implemented in the request. The local [ua.json](ua.json) is used as a fallback in case the data is corrupt or host is unreachable.

@@ -9,0 +9,0 @@ ```js

const userAgent = require('../index');
const uaJSON = require('../ua');

@@ -37,2 +38,8 @@ module.exports = t => {

});
t.test('ua.json - is an array of 10 user agent strings', async (t) => {
t.type(uaJSON, Array);
t.same(uaJSON.length, 10);
t.type(uaJSON[0], 'string');
t.same(uaJSON[0].substr(0, 13), 'Mozilla/5.0 (');
});

@@ -39,0 +46,0 @@ };

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