Binary Raw - Docs
    Preparing search index...

    Function detectEncoding

    • Detects the most likely encoding of a byte block. Priority: explicit BOM → valid UTF-8 → pure ASCII → Latin-1 → binary.

      Not infallible — it's a quick heuristic for the inspector. For production use a dedicated library (chardet, jschardet).

      Parameters

      • bytes: Uint8Array

        Byte block to analyze (doesn't need to be the whole file)

      Returns DetectedEncoding

      DetectedEncoding with detected encoding, whether there's a BOM, and where content starts