📜  使用节点 js 获取 ini 文件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:04.297000             🧑  作者: Mango

代码示例1
var fs = require('fs')
  , ini = require('ini')

var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))

config.scope = 'local'
config.database.database = 'use_another_database'
config.paths.default.tmpdir = '/tmp'
delete config.paths.default.datadir
config.paths.default.array.push('fourth value')

fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))