Download option while using figma code generation

When using Figma plugin for code generation in dev mode, the output is usually displayed in one of the subsections Inspect panel.
This output of code generation is available with one option - “Copy”
Is there a way to download the codegen output ?

Some codegen plugins provide the ability to export code snippets. Just click on the “Inspect settings” icon next to the plugin name and select the item you need.

I am unsure where this setting is.
This is what i see in my inspect panel for a codegen plugin


“Inspect settings” icon.

Thanks for the response. However this is not an exiting code generation plugin that i am trying to download.
I am creating a new plugin and want an option to download the generated output.
Can you please guide me for the same.

In this case, you need to study the following docs:

https://www.figma.com/plugin-docs/api/CodegenPreferencesEvent/

In short: add codegenPreferences to the manifest, listen to the preferenceschange event, pass the code to the UI and call the download function.

Thank you, i have already checked some of the docs and will explore others too.
Also you mentioned call the download function, are you referring to some native method for this ? Any example that i can leverage ?

You can also Google it yourself.

Ah nice, a javascript function is even better. Initially i thought if there is any native support from Figma for downloads. Thanks @tank666

Hi @nirvana7 and @tank666, I am working on a similar problem where I am trying to access the native HTML code generated by in the Figma Inspect panel shown below via the API →

Is there a way for my plugin to access this natively generated code via the API?

In this screenshot I can see that the HTML code was generated by a third party plugin. In this case, I suggest you contact its creator.