Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('create multi file torrent with nested directories', t => {
t.plan(21)
const startTime = Date.now()
createTorrent(fixtures.lotsOfNumbers.contentPath, {
// force piece length to 32KB so info-hash will
// match what transmission generated, since we use
// a different algo for picking piece length
pieceLength: 32768,
private: false // also force `private: false` to match transmission
}, (err, torrent) => {
t.error(err)
const parsedTorrent = parseTorrent(torrent)
t.equals(parsedTorrent.name, 'lots-of-numbers')
t.notOk(parsedTorrent.private)
test('create multi file torrent with array of paths', t => {
t.plan(20)
const number10Path = path.join(fixtures.lotsOfNumbers.contentPath, 'big numbers', '10.txt')
const number11Path = path.join(fixtures.lotsOfNumbers.contentPath, 'big numbers', '11.txt')
const numbersPath = fixtures.numbers.contentPath
const input = [number10Path, number11Path, numbersPath]
const startTime = Date.now()
createTorrent(input, {
name: 'multi',
// force piece length to 32KB so info-hash will
// match what transmission generated, since we use
// a different algo for picking piece length
pieceLength: 32768,
private: false // also force `private: false` to match transmission
test('create multi file torrent with array of mixed types', t => {
t.plan(20)
const number11Path = path.join(fixtures.lotsOfNumbers.contentPath, 'big numbers', '11.txt')
const number10Path = path.join(fixtures.lotsOfNumbers.contentPath, 'big numbers', '10.txt')
const numbersPath = fixtures.numbers.contentPath
const stream = fs.createReadStream(number10Path)
stream.name = '10.txt'
// Note: Order should be preserved
const input = [number11Path, stream, numbersPath]
const startTime = Date.now()
createTorrent(input, {
name: 'multi',
// force piece length to 32KB so info-hash will
// match what transmission generated, since we use
// a different algo for picking piece length
pieceLength: 32768,
test('create multi file torrent with array of mixed types', t => {
t.plan(20)
const number11Path = path.join(fixtures.lotsOfNumbers.contentPath, 'big numbers', '11.txt')
const number10Path = path.join(fixtures.lotsOfNumbers.contentPath, 'big numbers', '10.txt')
const numbersPath = fixtures.numbers.contentPath
const stream = fs.createReadStream(number10Path)
stream.name = '10.txt'
// Note: Order should be preserved
const input = [number11Path, stream, numbersPath]
const startTime = Date.now()
createTorrent(input, {
name: 'multi',
// force piece length to 32KB so info-hash will
// match what transmission generated, since we use
// a different algo for picking piece length