How to use the stringify function from ini

Find comprehensive JavaScript ini.stringify code examples handpicked from public code repositorys.

17
18
19
20
21
22
23
24
25
26
		node.error(e.message, msg);
	}
} else if (typeof value === 'object') {
	if (!Buffer.isBuffer(value)) {
		try {
			value = ini.stringify(value);
			RED.util.setMessageProperty(msg, node.property, value);
			node.send(msg);
		} catch (e) {
			node.error(RED._('parser-ini.errors.dropped-error'));
fork icon0
star icon3
watch icon4

259
260
261
262
263
264
265
266
267
  })
  if (cb) process.nextTick(cb)
  return this
}

var data = ini.stringify(target.data)

var then = function then (er) {
  if (er) return done(er)
fork icon0
star icon1
watch icon1

91
92
93
94
95
96
97
98
99
100
]).concat(Object.keys(npmconf.defaults).reduce(function (arr, key) {
  var obj = {}
  obj[key] = npmconf.defaults[key]
  if (key === 'logstream') return arr
  return arr.concat(
    ini.stringify(obj)
      .replace(/\n$/m, '')
      .replace(/^/g, '; ')
      .replace(/\n/g, '\n; ')
      .split('\n'))
fork icon0
star icon1
watch icon1

33
34
35
36
37
38
39
40
41
42
43
44
    if (width === undefined || height === undefined) {
      throw new DetoxRuntimeError(`Emulator with name ${avdName} has a corrupt config.ini file (${configFile}), try fixing it by recreating an emulator.`);
    }


    config['skin.name'] = `${width}x${height}`;
    fs.writeFileSync(configFile, ini.stringify(config));
  }
}


module.exports = { patchAvdSkinConfig };
fork icon0
star icon0
watch icon2

+ 6 other calls in file

212
213
214
215
216
217
218
219
220
221

// const iopath1 = path.join(__dirname, appconfig.sysIniUrl);
 // Info.config.ProType="小型站";
 console.log('授权ini文件路径', iopath);

 let IniData = ini.stringify(Info);
 var iniList = iconv.encode(IniData, 'GB2312');

 fs.writeFileSync(path.resolve(iopath1), iniList, { flag: 'w+', encoding: 'ascii' })
 res.status(200).send("授权成功,重启软件后生效").end();
fork icon0
star icon0
watch icon1

727
728
729
730
731
732
733
734
735
736
    this.delete(`${nerfed}:email`, 'user')
    this.set('email', email, 'user')
  }
}

const iniData = ini.stringify(conf.data).trim() + '\n'
if (!iniData.trim()) {
  // ignore the unlink error (eg, if file doesn't exist)
  await unlink(conf.source).catch(er => {})
  return
fork icon0
star icon0
watch icon1

26
27
28
29
30
31
32
33
34
35
}
const cfgPath = process.env.NODE_ENV === 'dev' ? './config.ini' : path.join(path.dirname(process.execPath), './config.ini')
const cfgExists = fs.existsSync(cfgPath)
if (!cfgExists) {
  consola.error('Config file not found, creating one...')
  fs.writeFileSync(cfgPath, ini.stringify(config))
} else {
  const parsedConfig = ini.parse(fs.readFileSync(cfgPath, 'utf-8'))
  config.vrchat.client_ip = parsedConfig?.vrchat?.client_ip || '127.0.0.1'
  config.vrchat.client_port = parsedConfig?.vrchat?.client_port || '9000'
fork icon0
star icon0
watch icon1