• Converts buffer to UTF‑8 string using detected encoding. Strips BOM if present.

    Parameters

    • buffer: Buffer

      Input buffer

    • encoding: string = 'utf8'

      Source encoding ('utf8', 'utf16le', 'utf16be')

    Returns string

    UTF‑8 string without BOM