lbry-desktop/web/src/tempfile.js

14 lines
310 B
JavaScript
Raw Normal View History

2021-11-17 19:28:36 +01:00
const fs = require('fs');
const path = require('path');
let tempFile;
async function getTempFile(ctx) {
const filename = ctx.params.filename;
if (!tempFile) {
tempFile = fs.readFileSync(path.join(__dirname, `/../dist/${filename}`), 'utf8');
}
return tempFile;
}
module.exports = { getTempFile };