Welcome to mirror list, hosted at ThFree Co, Russian Federation.

common.js « test - github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c306861a9312f55c7fbb6ef556163ff1422fdbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const os = require('os')
const fs = require('fs')
const path = require('path')

exports.getDownloadPath = function (infix, infoHash) {
  let downloadPath
  try {
    downloadPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent', 'test')
  } catch (err) {
    downloadPath = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/', 'webtorrent', 'test')
  }
  return path.join(downloadPath, infix, infoHash)
}