mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 12:14:00 +00:00
16 lines
325 B
JavaScript
16 lines
325 B
JavaScript
export async function parseFileAsJson(file) {
|
|
try {
|
|
const text = await file.text();
|
|
const data = JSON.parse(text);
|
|
return {
|
|
success: true,
|
|
data,
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
success: false,
|
|
error: error instanceof Error ? error.message : 'Unknown parsing error',
|
|
};
|
|
}
|
|
}
|