@tinyhttp/bot-detector
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@tinyhttp/bot-detector

npm (scoped) npm GitHub Workflow Status Coverage Codacy grade

Bot detector middleware for Node.js based on isbot.

Note that it only shows if a request comes from a bot (e.g. crawler) or from a real human.

Install

pnpm i @tinyhttp/bot-detector

Examples

Vanilla

import { createServer } from 'http'
import { botDetector, RequestWithBotDetector } from '@tinyhttp/bot-detector'

createServer((req, res) => {
  botDetector(req as RequestWithBotDetector, res, () => {
    res.send((req as RequestWithBotDetector).isBot ? `Bot detected 🤖: ${req.botName}` : 'Hello World!')
  })
}).listen(3000)

tinyhttp

import { App } from '@tinyhttp/app'
import { botDetector, RequestWithBotDetector } from '@tinyhttp/bot-detector'

new App<any, RequestWithBotDetector>()
  .use(botDetector())
  .use((req, res) => {
    res.send(req.isBot ? `Bot detected 🤖: ${req.botName}` : 'Hello World!')
  })
  .listen(3000)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.011latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.011
1.3.113
1.3.91
1.3.81
1.3.71
1.3.61
1.3.51
1.3.42
1.3.32
1.3.21
1.3.12
1.3.02
1.2.251
1.2.241
1.2.232
1.2.221
1.2.211
1.2.191
1.2.181
1.2.171
1.2.161
1.2.151
1.2.141
1.2.132
1.2.121
1.2.111
1.2.102
1.2.91
1.2.81
1.2.71
1.2.62
1.2.52
1.2.32
1.2.21
1.2.12
1.2.03
1.1.181
1.1.161
1.1.141
1.1.132
1.1.121
1.1.111
1.1.103
1.1.81
1.1.71
1.1.62
1.1.52
1.1.41
1.1.32
1.1.21
1.1.12
1.1.02
1.0.191
1.0.181
1.0.172
1.0.161
1.0.152
1.0.141
1.0.131
1.0.121
1.0.111
1.0.101
1.0.92
1.0.81
1.0.71
1.0.61
1.0.52
1.0.42
1.0.31
1.0.23
1.0.11
1.0.03
0.5.363
0.5.353
0.5.341
0.5.331
0.5.322
0.5.301
0.5.291
0.5.283
0.5.271
0.5.261
0.5.251
0.5.241
0.5.231
0.5.221
0.5.211
0.5.201
0.5.193
0.5.163
0.5.152
0.5.142
0.5.132
0.5.121
0.5.112
0.5.101
0.5.91
0.5.83
0.5.73
0.5.61
0.5.51
0.5.31
0.5.22
0.5.11
0.4.173
0.4.151
0.4.142
0.4.132
0.4.121
0.4.114
0.4.101
0.4.91
0.4.82
0.4.71
0.4.62
0.4.51
0.4.31
0.4.21
0.4.11
0.4.01
0.1.184
0.1.171
0.1.161
0.1.151
0.1.142
0.1.132
0.1.111
0.1.103
0.1.91
0.1.81
0.1.41
0.1.32
0.1.11
0.1.01
0.0.81
0.0.61
0.0.51
0.0.41
0.0.31
0.0.23

Package Sidebar

Install

npm i @tinyhttp/bot-detector

Weekly Downloads

60

Version

2.0.0

License

MIT

Unpacked Size

6.43 kB

Total Files

5

Last publish

Collaborators

  • dropthebeatbro