Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zbinlin/ip-helper
ip calculate helper
https://github.com/zbinlin/ip-helper
Last synced: 4 days ago
JSON representation
ip calculate helper
- Host: GitHub
- URL: https://github.com/zbinlin/ip-helper
- Owner: zbinlin
- Created: 2015-09-19T16:24:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-08T04:00:07.000Z (about 6 years ago)
- Last Synced: 2024-11-08T08:05:18.698Z (8 days ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ip-helper
ip calculate helper
## Usage
```javascript
var ipHelper = require("ip-helper");console.log(ipHelper.str2buf("127.0.0.1")); //
console.log(ipHelper.buf2str(new Buffer([0x7f, 0x00, 0x00, 0x01]))); // 127.0.0.1
```** News in version 2.0.0 **
> Only supports Node.js v6+
* add ip range Iterator
```javascript
const { convertIPRangeToIterator } = require("ip-helper");console.log([...convertIPRangeToIterator("127.0.0.1/31")]); // ["127.0.0.0", "127.0.0.1"]
console.log([...convertIPRangeToIterator("127.0.0.1-2")]); // ["127.0.0.1", "127.0.0.2"]for (const ip of convertIPRangeToIterator("127.0.0.-")) {
console.log(ip); // "127.0.0.0", ..., "127.0.0.255"
}
```