File tree Expand file tree Collapse file tree 5 files changed +1082
-44
lines changed
Expand file tree Collapse file tree 5 files changed +1082
-44
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,26 @@ Load the IP2Location BIN database for lookup.
1212:param str binPath: (Required) The file path links to IP2Location BIN databases.
1313```
1414
15+ ``` {py:function} openAsync(binPath)
16+ Load the IP2Location BIN database for lookup asynchronously.
17+
18+ :param str binPath: (Required) The file path links to IP2Location BIN databases.
19+ ```
20+
1521``` {py:function} getAll(ipAddress)
1622Retrieve geolocation information for an IP address.
1723
1824:param str ipAddress: (Required) The IP address (IPv4 or IPv6).
1925:return: Returns the geolocation information in array. Refer below table for the fields avaliable in the array
2026:rtype: array
2127
28+ {py:function} getAllAsync(ipAddress)
29+ Retrieve geolocation information for an IP address asynchronously.
30+
31+ :param str ipAddress: (Required) The IP address (IPv4 or IPv6).
32+ :return: Returns the geolocation information in a Promise of an array. Refer below table for the fields avaliable in the array
33+ :rtype: Promise of an array
34+
2235**RETURN FIELDS**
2336
2437| Field Name | Description |
Original file line number Diff line number Diff line change @@ -52,6 +52,30 @@ for (var x = 0; x < testip.length; x++) {
5252ip2location .close ();
5353```
5454
55+ ### Query geolocation information from BIN database asynchronously
56+
57+ You can asynchronously query the geolocation information from the IP2Location BIN database as below:
58+
59+ ``` javascript
60+
61+ const {IP2Location } = require (" ip2location-nodejs" );
62+
63+ let ip2location = new IP2Location ();
64+
65+ testip = [' 8.8.8.8' , ' 2404:6800:4001:c01::67' ];
66+
67+ ip2location .openAsync (" ./DB26.BIN" ).then (() => {
68+ for (var x = 0 ; x < testip .length ; x++ ) {
69+ ip2location .getAllAsync (testip[x]).then (result => {
70+ for (var key in result) {
71+ console .log (key + " : " + result[key]);
72+ }
73+ console .log (" --------------------------------------------------------------" );
74+ });
75+ }
76+ });
77+ ```
78+
5579### Processing IP address using IP Tools class
5680
5781You can manupulate IP address, IP number and CIDR as below:
Original file line number Diff line number Diff line change 11{
22 "name" : " ip2location-nodejs" ,
3- "version" : " 9.5 .0" ,
3+ "version" : " 9.6 .0" ,
44 "description" : " IP2Location geolocation component" ,
55 "keywords" : [
66 " ip2location" ,
You can’t perform that action at this time.
0 commit comments