@ahmedrangel/rand-user-agent
TypeScript icon, indicating that this package has built-in type declarations

2.0.22 • Public • Published

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);

Package Sidebar

Install

npm i @ahmedrangel/rand-user-agent

Weekly Downloads

23

Version

2.0.22

License

ISC

Unpacked Size

40.4 kB

Total Files

4

Last publish

Collaborators

  • ahmedrangel