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

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

/@ahmedrangel/rand-user-agent/

    Package Sidebar

    Install

    npm i @ahmedrangel/rand-user-agent

    Weekly Downloads

    8

    Version

    2.0.15

    License

    ISC

    Unpacked Size

    501 kB

    Total Files

    9

    Last publish

    Collaborators

    • ahmedrangel