2023-12-18 13:12:25 +08:00
|
|
|
var defaultEncoding
|
|
|
|
/* istanbul ignore next */
|
2024-01-16 21:26:16 +08:00
|
|
|
if (global.process && global.process.browser) {
|
2023-12-18 13:12:25 +08:00
|
|
|
defaultEncoding = 'utf-8'
|
2024-01-16 21:26:16 +08:00
|
|
|
} else if (global.process && global.process.version) {
|
2023-12-18 13:12:25 +08:00
|
|
|
var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
|
|
|
|
|
|
|
|
defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
|
2024-01-16 21:26:16 +08:00
|
|
|
} else {
|
|
|
|
defaultEncoding = 'utf-8'
|
2023-12-18 13:12:25 +08:00
|
|
|
}
|
|
|
|
module.exports = defaultEncoding
|