Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ahmedrangel/rand-user-agent

ahmedrangel194ISC2.0.23TypeScript support: included

This is an adapted version of rand-user-agent by WebScrapingAPI specifically designed for environments lacking access to server file systems (fs), such as Cloudflare Workers.

user-agent, user, agent, nodejs, agents, user-agents, random, random-user-agent, randomizer, cloudflare-workers

readme

Random User Agent

This is an adapted version of rand-user-agent by WebScrapingAPI specifically designed for environments lacking access to server file systems (fs), such as Cloudflare Workers.

Installation

Run the following command in the main folder of your project:

# Using npm
npm i @ahmedrangel/rand-user-agent

# Using pnpm
pnpm add @ahmedrangel/rand-user-agent

# Using yarn
yarn add @ahmedrangel/rand-user-agent

Usage Example

import { randUA } from "@ahmedrangel/rand-user-agent";

// ...

const agent = randUA("desktop");

console.log(agent);

You can also provide a browser and an operating system in the parameters of randUA in order to filter out the user agents:

import { randUA } from "@ahmedrangel/rand-user-agent";

// ...

const agent = randUA("desktop", "chrome", "linux");

console.log(agent);