New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ipdb

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipdb - npm Package Compare versions

Comparing version

to
0.3.0

8

index.js
const fs = require('fs')
const net = require('net')
const isBuffer = obj => {
return obj !== null && obj.constructor !== null &&
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
class Parse {
constructor(filename, options = {}) {
const data = fs.readFileSync(filename)
const data = isBuffer(filename) ? filename : fs.readFileSync(filename)
const metaLen = data.readInt32BE(0)

@@ -9,0 +13,0 @@ const meta = data.slice(4, 4 + metaLen)

{
"name": "ipdb",
"version": "0.2.2",
"version": "0.3.0",
"description": "IP lookup using IPIP.net database",

@@ -24,3 +24,3 @@ "license": "MIT",

"@ipdb/database": "^2019.1.9",
"ava": "^1.3.1",
"ava": "^2.1.0",
"xo": "^0.24.0"

@@ -27,0 +27,0 @@ },

@@ -35,4 +35,49 @@ # ipdb [![Build Status](https://travis-ci.com/metowolf/ipdb.svg?branch=master)](https://travis-ci.com/metowolf/ipdb)

## Related
## API
### ipdb = new IPDB(file, [options])
#### file
Type: `string | Buffer`
The ipdb database pathname (string) or contents (buffer).
#### options
Type: `object`
##### patches
Type: `array`
Default: `[]`
See [Patches](#patches)
### ipdb.find(ip, [options])
Return a result `object`
#### ip
Type: `string`
#### options
Type: `object`
##### language
Type: `string`
Default: `CN`
##### patches
Type: `array`
Default: `[]`
See [Patches](#patches)
## Patches
- [@ipdb/iso3166](https://github.com/metowolf/ipdb-iso3166) - IPIP.net database patches (ISO-3166)

@@ -42,5 +87,10 @@ - [@ipdb/cac](https://github.com/metowolf/ipdb-cac) - IPIP.net database patches (中国行政区划代码)

## Related
- [@ipdb/database](https://www.npmjs.com/package/@ipdb/database) - IPIP.net free database
- [qqwry.ipdb](https://www.npmjs.com/package/qqwry.ipdb) - 纯真数据库 IPIP.net 格式版
## License
MIT © [metowolf](https://i-meto.com/)