Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am new to nodejs. When i tried to run the below code, it not giving me the correct out put. according to me the below program will generate a 'tmp.torrent' file . But it is not happening.

What I have tried:

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);
});
Posted
Updated 10-Jul-17 12:27pm

1 solution

Hi,

seems you are not handling error, and probably there are some connectivity issues, I suppose

torrent.getMetadata().then(function data (buf) {
  fs.writeFileSync('tmp.torrent', buf)
}, function err (err) {
  console.log('ERR', err)
})


see error, handle it...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900