This commit is contained in:
Jan Prochazka
2020-10-18 10:36:24 +02:00
parent b0f0710a75
commit 69ea8010d2
7 changed files with 74 additions and 17 deletions

View File

@@ -0,0 +1,12 @@
const path = require('path');
const { jsldir, archivedir } = require('./directories');
function getJslFileName(jslid) {
const archiveMatch = jslid.match(/^archive:\/\/([^/]+)\/(.*)$/);
if (archiveMatch) {
return path.join(archivedir(), archiveMatch[1], `${archiveMatch[2]}.jsonl`);
}
return path.join(jsldir(), `${jslid}.jsonl`);
}
module.exports = getJslFileName;