Format external media

Is there a simple way of formatting external media?
I want to be able to format an SD card within my application.

Right now I target MacOS. But I might want to make a Windows version in the future as well.

I’d do it through a Shell using diskutil.

Yeah, that was my guess, too…
I was just wondering if there was another way. But I guess Shell will have to do