Nodejs没有写文件

时间:2017-05-27 11:51:26

标签: javascript node.js filestream

我是nodejs的新手。当我试图运行以下代码时,它没有给我正确的输出。据我所知,下面的程序将生成一个'tmp.torrent'文件。但它没有发生。

    var Torrent = require('webseeded-torrent-generator');
    var fs = require('fs');
    var base = 'http://ia700201.us.archive.org/6/items/';
    var name = 'jj2005-02-27.fm.shnf';
    var files = [
        'jj2005-02-27.fm.d1.md5',
        'jj2005-02-27.fm.d1.txt'
    ];

    var torrent = new Torrent(base, name, files);
    torrent.getMetadata().then(function (buf) {
        fs.writeFileSync('tmp.torrent', buf);
    });

我得到的输出是

{"name":"torrent","hostname":"runnable","pid":279,"level":10,"msg":"\u001b[36m\n--- OUTSTANDING PROMISES ---\n\u001b[39m\u001b[36m\n\t\u001b[39m\u001b[36mget signatures\u001b[39m\u001b[36m\t\t\u001b[39m\u001b[32ma few   
 seconds ago\u001b[39m\u001b[36m\n\n------------------------------\n\n\u001b[39m","time":"2017-05-28T03:25:31.011Z","v":0}                                                                                                  

0 个答案:

没有答案