New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ahmedrangel/rand-user-agent

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahmedrangel/rand-user-agent - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

dist/data/user-agents.json

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export declare const randUA: (data: Record<string, any>, device: string, browser?: string | null, os?: string | null) => string;
export declare const randUA: (device: string, browser?: string | null, os?: string | null) => string;
//# sourceMappingURL=index.d.ts.map

@@ -1,3 +0,6 @@

import { JSONfrequencyNormalize, JSONIsFrequency, JSONinterval, randomElement, } from "./helpers.js";
export const randUA = (data, device, browser = null, os = null) => {
import { JSONfrequencyNormalize, JSONIsFrequency, JSONinterval, randomElement } from "./helpers.js";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const data = require("./data/user-agents.json");
export const randUA = (device, browser = null, os = null) => {
let content = data;

@@ -4,0 +7,0 @@ content = JSONfrequencyNormalize(content);

{
"name": "@ahmedrangel/rand-user-agent",
"version": "1.0.1",
"description": "This is an adapted version of rand-user-agent specifically designed for environments lacking access to server file systems, such as Cloudflare Workers.",
"version": "2.0.0",
"description": "This is an adapted version of rand-user-agent specifically designed for environments lacking access to server file systems (fs), such as Cloudflare Workers.",
"exports": "./dist/index.js",

@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts",

# Random User Agent
This is an adapted version of [rand-user-agent](https://www.npmjs.com/package/rand-user-agent) specifically designed for environments lacking access to server file systems, such as Cloudflare Workers.
- Obtain the dataset of User-Agents by downloading the raw JSON file from the [rand-user-agent data](https://raw.githubusercontent.com/WebScrapingAPI/rand-user-agent/master/data/user-agents.json) by WebScrapingAPI.
- Enhance access efficiency by storing this data in a Bucket service of your convenience (Amazon S3, Cloudflare R2, ...).
This is an adapted version of [rand-user-agent](https://www.npmjs.com/package/rand-user-agent) specifically designed for environments lacking access to server file systems (fs), such as Cloudflare Workers.

@@ -29,10 +27,4 @@ ## Installation

// Fetching the raw JSON URL file from rand-user-agent repository
// const response = await fetch("https://raw.githubusercontent.com/WebScrapingAPI/rand-user-agent/master/data/user-agents.json");
const agent = randUA("desktop");
// Using Coudflare R2
const response = await env.YOUR_BUCKET.get("user-agents.json");
const jsonData = await response.json();
const agent = randUA(jsonData, "desktop");
console.log(agent);

@@ -48,5 +40,5 @@ ```

const agent = randUA(jsonData, "desktop", "chrome", "linux");
const agent = randUA("desktop", "chrome", "linux");
console.log(agent);
```

Sorry, the diff of this file is not supported yet

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