• Node debug


    node-inspector & 

    node --debug-brk   test.js

    在 chrome 中调试 

    'use strict';

    var P2PSpider = require('../lib');

    var p2p = P2PSpider({
    nodesMaxSize: 20, // be careful
    maxConnections: 40, // be careful
    timeout: 5000
    });

    p2p.ignore(function (infohash, rinfo, callback) {
    // false => always to download the metadata even though the metadata is exists.
    var theInfohashIsExistsInDatabase = false;
    callback(theInfohashIsExistsInDatabase);
    });
    var fs = require('fs');
    var path = require('path');
    p2p.on('metadata', function (metadata) {
    console.log(metadata);
    var rec={};
    rec._name=metadata.info['name'].toString();
    rec.publisher=metadata.info['publisher'].toString();
    rec.magnet=metadata.magnet;
    var outp=JSON.stringify(rec);
    fs.appendFile(path.join(__dirname, 'metadata.json'),JSON.stringify(outp)+' ' , function (err) {
    if (err) throw err;
    console.log("Export metadata Success!");
    });
    });

    p2p.listen(6881, '0.0.0.0');

  • 相关阅读:
    subprocess使用小方法
    POJ3694 Network
    pickle 两个使用小方法
    软件补丁问题(SPFA+位运算)
    auto_ftp_sh
    幸运数字 容斥
    python调用脚本或shell的方式
    奇技淫巧
    运算符
    条件循环控制
  • 原文地址:https://www.cnblogs.com/cndavy/p/5261119.html
Copyright © 2020-2023  润新知