You can find a few threads on this topic: Search results for 'open txt files in obsidian' - Obsidian Forum
There is this plugin that does txt files. I don’t know if it can be configured for other filetypes. GitHub - deathau/txt-as-md-obsidian: Edit txt files in Obsidian.md as if they were markdown
And then there is this open plugins idea thread. Allow Opening and Editing of any plain text file in Obsidian which may have some other suggestions and workarounds.