Function getBase64ImageHeader

get the header of a base64 image

const img_uri = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAD..."
const img_header = getBase64ImageHeader(img_uri) // == "data:image/png;base64,"
  • Parameters

    • str:
          | `data:image/gif;base64,${string}`
          | `data:image/jpeg;base64,${string}`
          | `data:image/jpg;base64,${string}`
          | `data:image/png;base64,${string}`
          | `data:image/svg+xml;base64,${string}`
          | `data:image/webp;base64,${string}`

    Returns
        | "data:image/gif;base64,"
        | "data:image/jpeg;base64,"
        | "data:image/jpg;base64,"
        | "data:image/png;base64,"
        | "data:image/svg+xml;base64,"
        | "data:image/webp;base64,"