compact2string中文文档|compact2string js中文教程|解析

npm npmdoc 2年前 (2021-12-29) 371次浏览

compact2string中文文档|compact2string js中文教程|解析

安装命令:npm i compact2string

compact2string

跟踪器返回的bittorrent 的紧凑ip/host 二进制文件转换为“主机名:端口”字符串。

构建状态
覆盖状态
依赖状态

浏览器支持

需要反过来吗?结帐https://github.com/feross/string2compact

安装

npm install compact2string

用法

单紧凑2串

var compact2string = require("compact2string");
var Buffer = require("buffer").Buffer;
var ipport = compact2string(new Buffer("0A0A0A05FF80", "hex"));
console.log(ipport);

=> "10.10.10.5:65408"

ipport = compact2string(new Buffer("2a03288021109f07faceb00c000000010050", "hex"));
console.log(ipport);

=> "[2a03:2880:2110:9f07:face:b00c::1]:80"

多个在同一个缓冲区

var hostports = compact2string.multi(new Buffer("0A0A0A05008064383a636f6d", "hex"));
console.log(hostports);

=> [ '10.10.10.5:128', '100.56.58.99:28525' ]

IPv6版本: compact2string.multi6()

执照

(麻省理工学院执照)

项目贡献人员列表:


极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:compact2string中文文档|compact2string js中文教程|解析
喜欢 (0)
.excerpt .focus {display:none}