ini
ini copied to clipboard
Encode values without quoting (unsafe encoding)
When encoding a Base64 String with padding, the parser quotes it. But since another parser does not understand these quotes, it fails to decode the string.
let buf = new Buffer(16), // Buffer filled with random bytes
section = ini.parse('[section]\nkey=' + buf.toString());
console.log(section); // { section: { key: 'UPIvqf0AAABA5i+p/QAAAA==' } }
console.log(encode(section)); // key="4EQ8rlYAAAAQlTWuVgAAAA=="
Hence I suggest to add an option to allow for unsafe encoding.
+1
I would like to have the option too, since safe breaks aws credentials file
You can try my fork, ini-win, which aims to be more compatible with the way Windows handles ini files. It quotes the value only in two cases, if the value has leading or trailing whitespace, or if the value is already quoted.
You can try my fork, ini-win, which aims to be more compatible with the way Windows handles ini files. It quotes the value only in two cases, if the value has leading or trailing whitespace, or if the value is already quoted.
Thanks for your fork!
If this is something folks still need feel free to submit a PR implementing this flag.