(
bytes_: ByteArray,
opts: BytesToStringOpts = {},
)
| 215 | * // 'Hello world' |
| 216 | */ |
| 217 | export function bytesToString( |
| 218 | bytes_: ByteArray, |
| 219 | opts: BytesToStringOpts = {}, |
| 220 | ): string { |
| 221 | let bytes = bytes_ |
| 222 | if (typeof opts.size !== 'undefined') { |
| 223 | assertSize(bytes, { size: opts.size }) |
| 224 | bytes = trim(bytes, { dir: 'right' }) |
| 225 | } |
| 226 | return new TextDecoder().decode(bytes) |
| 227 | } |
no test coverage detected