Get container that supports codec using ffmpeg

I’m trying to write a program that extracts the first audio track from a video and saves it to a separate file using ffmpeg-wasm.

The problem is that I’m trying not to re-encode the audio stream (e.g use -c:a copy) mostly for performance reasons, but I don’t know what video/audio format the user will be uploading. It could be any codec, but I need to know the correct file extension to use both to let the user play the file separately and because ffmpeg requires it when specifying the output.

I’ve found a ffprobe command which allows me to get the audio codec used in the file (e.g aac or vorbis).
What I don’t get is how to get a container that supports the given codec and then find the correct file extension for that container, which I would then pass as output.fileextension to ffmpeg.

Supposing I’ve detected the file uses vorbis codec for the audio, is there an ffmpeg or ffprobe command which would let me know that vorbis can be put into an ogg container, which uses the file extension .ogg? Or maybe a separate library or even a list somewhere?