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

fastify-user-agent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-user-agent

User-agent information plugin for Fastify

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
502
decreased by-3.46%
Maintainers
1
Weekly downloads
 
Created
Source

fastify-user-agent

User-agent information plugin for Fastify.

JavaScript Style Guide Build Status

Install

npm install fastify-user-agent

Compatibility

Plugin versionFastify version
^1.0.0^4.0.0

Usage

The plugin adds a userAgent property to the request object by parsing the user-agent header.
The object is an agent instance and it has the following properties:

  • family The browser family, or browser name, it defaults to Other.
  • major The major version number of the family, it defaults to 0.
  • minor The minor version number of the family, it defaults to 0.
  • patch The patch version number of the family, it defaults to 0.
  • os OperatingSystem instance
  • device Device instance
const fastify = require('fastify')

const app = fastify()
app.register(require('fastify-user-agent'))

app.get('/', async (request, reply) => {
  return request.userAgent
})

app.listen({ port: 3000 })

Options

You can pass the following options during the registration:

OptionDefaultDescription
nameuserAgentChange the request property name where the plugin will store the parsed user-agent information.

License

Licensed under MIT.

Keywords

FAQs

Package last updated on 13 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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