mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 09:33:34 -06:00
Chore: use native async fs.readFile in json-file-to-job-output script (#66686)
This commit is contained in:
parent
2521fa9448
commit
86be40555f
@ -1,7 +1,7 @@
|
||||
module.exports = async ({ core, filePath }) => {
|
||||
try {
|
||||
const fs = require('fs');
|
||||
const content = await readFile(fs, filePath);
|
||||
const fs = require('fs').promises;
|
||||
const content = await fs.readFile(filepath)
|
||||
const result = JSON.parse(content);
|
||||
|
||||
core.startGroup('Parsing json file...');
|
||||
@ -15,13 +15,4 @@ module.exports = async ({ core, filePath }) => {
|
||||
} catch (error) {
|
||||
core.restFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function readFile(fs, path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(path, (error, data) => {
|
||||
if (error) return reject(error);
|
||||
return resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user