pl2mp3
Version:
Watches Youtube Playlists and automatically downloads & converts them to mp3
19 lines (16 loc) • 537 B
JavaScript
const fs = require("fs")
const path = require("upath")
const config = "config.json"
const db = "db.json"
const sanitize = require("sanitize-filename");
module.exports = (basePath) => {
console.log(`Creating new installation at ${basePath}`)
let dbPath = path.join(basePath, db)
let configPath = path.join(basePath, config)
if (!fs.existsSync(basePath))
fs.mkdirSync(sanitize(basePath))
if (!fs.existsSync(configPath))
fs.copyFileSync("sampleConfig.json", configPath)
if (!fs.existsSync(dbPath))
fs.openSync(dbPath, 'w');
}