1.0.7 • Published 2 years ago
telize-node v1.0.7
⚠️ This package has been deprecated.
An asynchronous client library for Telize API.
Installation
npm install telize-node
Quick Start
The quickest way to get started is by executing following code:
var telize = require('telize-node')();
telize.getIP(function (error, ip) {
if (!error) {
console.log(ip);
} else {
console.error(error);
}
});
If everything went well, you'll see your current IP address in the console:
46.19.37.108
Documentation
getIP
Requests current IP address.
Example
Requests current IP address.
telize.getIP(function (error, ip) {
if (!error) {
console.log(ip);
} else {
console.error(error);
}
});
Errors
When errors occur, you receive an error object with default properties as a first argument of the callback.
getGeoIP
Requests Geo IP data.
Examples
Requests GeoIP data for current IP address.
telize.getGeoIP(function (error, data) {
if (!error) {
console.log(data);
} else {
console.error(error);
}
});
Requests GeoIP data for manually set IPv4 address.
telize.getGeoIP('46.19.37.108', function (error, data) {
if (!error) {
console.log(data);
} else {
console.error(error);
}
});
Requests GeoIP data for manually set IPv6 address.
telize.getGeoIP('2a02:2770::21a:4aff:feb3:2ee', function (error, data) {
if (!error) {
console.log(data);
} else {
console.error(error);
}
});
Errors
When errors occur, you receive an error object with default properties as a first argument of the callback.
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
License
Distributed under the MIT License.