How does the Unity editor import raw

I cannot load raw as a Texture2D - how does unity handle .raw files in the editor? How would I go about figuring that out?

So I used ILSpy to open UnityEditor.dll and found the method the editor uses:

UnityEditor.ImportRawHeightmap → ReadRaw

Hopefully I can adapt this for use at runtime…