I have a js file that contains some dictionary structure like below example-
File: read_js.js
export default {
title: 'Backups',
docTitle: 'Backups',
navTitle: 'Backups',
headers: {
source_name: 'Source Volume (Path)',
source_type: 'Type',
source_zone: 'Source Zone',
}
}
I want to add some data in this dictionary using typescript. How can I achieve this? I tried fs.readFileSync('read_js.js', 'utf8')
but this returns all the text present in the file so couldn't read the dictionary and append my own key-value and re-write into the js file.