Click here to Skip to main content
15,799,257 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 = '';
var name = '';
var files = [
var torrent = new Torrent(base, name, files);
torrent.getMetadata().then(function (buf) {
    fs.writeFileSync('tmp.torrent', buf);
Updated 10-Jul-17 13:27pm

1 solution


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