(item)
| 1114 | * @returns {string | Buffer | undefined} content of file |
| 1115 | */ |
| 1116 | const readFile = (item) => { |
| 1117 | if ( |
| 1118 | Buffer.isBuffer(item) || |
| 1119 | (typeof item === "object" && item !== null && !Array.isArray(item)) |
| 1120 | ) { |
| 1121 | return item; |
| 1122 | } |
| 1123 | |
| 1124 | if (item) { |
| 1125 | let stats = null; |
| 1126 | |
| 1127 | try { |
| 1128 | stats = fs.lstatSync(fs.realpathSync(item)).isFile(); |
| 1129 | } catch { |
| 1130 | // Ignore error |
| 1131 | } |
| 1132 | |
| 1133 | // It is a file |
| 1134 | return stats ? fs.readFileSync(item) : item; |
| 1135 | } |
| 1136 | }; |
| 1137 | |
| 1138 | /** @type {EXPECTED_ANY} */ |
| 1139 | (serverOptions)[property] = Array.isArray(value) |
no outgoing calls
no test coverage detected