(name: string, radix: 8 | 10 = 10)
| 154 | * @since 4.0.0 |
| 155 | */ |
| 156 | export const nameTextFromResolver = (name: string, radix: 8 | 10 = 10): string => { |
| 157 | if (!name.includes("\\")) return absoluteName(name) |
| 158 | const bytes: Array<number> = [] |
| 159 | for (const [part, digits, escaped] of name.matchAll(nameParts)) { |
| 160 | if (digits !== undefined) { |
| 161 | const byte = Number.parseInt(digits, radix) |
| 162 | if (byte === 46 || byte === 92) bytes.push(92) |
| 163 | bytes.push(byte) |
| 164 | } else if (escaped !== undefined) { |
| 165 | if (escaped === "." || escaped === "\\") bytes.push(92) |
| 166 | bytes.push(...encoder.encode(escaped)) |
| 167 | } else { |
| 168 | bytes.push(...encoder.encode(part)) |
| 169 | } |
| 170 | } |
| 171 | return absoluteName(decoder.decode(Uint8Array.from(bytes))) |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Converts a number of seconds that a resolver reports as a signed 32-bit |
no test coverage detected