1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00
programming-challenges/scripts/languages-wrapper/execute.js

21 lines
508 B
JavaScript
Raw Normal View History

2020-07-05 15:48:51 +02:00
const path = require('path')
const fs = require('fs').promises
const solution = require('./solution')
const inputPath = path.join(__dirname, 'input.json')
const outputPath = path.join(__dirname, 'output.json')
const main = async () => {
const inputFile = await fs.readFile(inputPath)
const inputJSON = JSON.parse(inputFile)
try {
const result = solution.apply(null, inputJSON)
await fs.writeFile(outputPath, JSON.stringify(result))
} catch (error) {
console.error(error)
}
2020-07-05 15:48:51 +02:00
}
main()