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: 4c3bf2870ed81372b8459cfb5897b57e35d188de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os from 'os'
import fs from 'fs'
import path from 'path'

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

export default { getDownloadPath }