'Viewer: check filetype

Im working with the Forge React viewer. We are currently getting the filetype before loading files into the viewer from our JSTree and store in the client. I was wondering if there is a native way within the viewer to get the filetype of a loaded model?



Solution 1:[1]

I assume that you want to know the file extension of the source model after translating it to svf/svf2. So, you can see that in this way:

let model = viewer.model;

let fileExtension = model.getData()?.loadOptions?.fileExt;

here is an example: https://gist.github.com/yiskang/b1f68f5f4b8e4b8d420b6b64e95c48ac

Solution 2:[2]

predb = cluster["discord"]["prefix"]


async def get_prefix(client, message):
    stats = await predb.find_one({"guild": message.guild.id})
    # server_prefix = stats["prefix"]
    if stats is None:
        updated = {"guild": message.guild.id, "prefix": "?"} 
        await predb.insert_one(updated)
        extras = "?"
        return commands.when_mentioned_or(extras)(client, message)
    else:
        extras = stats["prefix"]
        return commands.when_mentioned_or(extras)(client, message)

use this in getting prefix

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eason Kang
Solution 2 Pranjal Prakarsh