A JavaScript client for Google Safe Browsing API
Finds the threat entries that match the Safe Browsing lists.
import { GoogleSafeBrowsing } from '@hckhanh/google-safe-browsing' const client = new GoogleSafeBrowsing('apiKey') const result = await client.findThreatMatches({ client: { clientId: 'uniqueClientId', clientVersion: '1.0.0', }, threatInfo: { threatTypes: ['MALWARE', 'SOCIAL_ENGINEERING'], platformTypes: ['ALL_PLATFORMS'], threatEntryTypes: ['URL'], threatEntries: [ { url: 'http://malware.testing.google.test/testing/malware/' }, ], }, }) const hasRisk = result.matches !== undefined && result.matches.length > 0
You can go to the Releases page to see the release notes.
Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources. The Safe Browsing APIs are for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial purposes – meaning “for sale or revenue-generating purposes” – please refer to the Web Risk API.
Add Package
deno add jsr:@hckhanh/google-safe-browsing
Import symbol
import * as google_safe_browsing from "@hckhanh/google-safe-browsing";
Import directly with a jsr specifier
import * as google_safe_browsing from "jsr:@hckhanh/google-safe-browsing";
Add Package
pnpm i jsr:@hckhanh/google-safe-browsing
pnpm dlx jsr add @hckhanh/google-safe-browsing
Import symbol
import * as google_safe_browsing from "@hckhanh/google-safe-browsing";
Add Package
yarn add jsr:@hckhanh/google-safe-browsing
yarn dlx jsr add @hckhanh/google-safe-browsing
Import symbol
import * as google_safe_browsing from "@hckhanh/google-safe-browsing";
Add Package
npx jsr add @hckhanh/google-safe-browsing
Import symbol
import * as google_safe_browsing from "@hckhanh/google-safe-browsing";
Add Package
bunx jsr add @hckhanh/google-safe-browsing
Import symbol
import * as google_safe_browsing from "@hckhanh/google-safe-browsing";