Yes, Figma plugins have several mechanisms for storing cached data:
Figma provides the figma.clientStorage
API specifically designed for plugins to store data on the user's local machine. This storage mechanism:
- Allows storing up to 5MB of data per plugin[2]
- Supports storing various data types including objects, arrays, strings, numbers, booleans, null, undefined, and
Uint8Array
[2] - Is asynchronous and provides methods like
getAsync()
,setAsync()
,deleteAsync()
, andkeysAsync()
[2] - Is specific to your plugin ID, meaning other plugins cannot access this data[2]
- Is stored privately for stability rather than security[2]
The data stored using clientStorage
is not synchronized across users, unlike data stored with the document (such as setPluginData
)[2]. It's important to note that this data might be cleared if users clear their browser cache[2].
Since Figma is browser-based (even the desktop app is Electron-based, which is essentially Chrome), plugins can leverage the browser's storage capabilities:
- Temporary files for the session and local changes are typically stored in hidden folders in your documents folder[1]
- Most browsers allow Figma to store data for up to 30 days, while Safari stores data for 7 days[8]
- This storage is used for Figma's offline functionality but can also be utilized by plugins
Plugins can also store data directly with the document using the setPluginData
method[12]. This differs from clientStorage
as:
- The data is stored with the document itself
- It's synchronized across users who access the same file
- It persists as long as the document exists
When developing Figma plugins that need to store cached data:
- For user-specific settings or preferences,
clientStorage
is ideal - For data that should persist with the document,
setPluginData
is more appropriate - Be mindful of storage quotas, especially with
clientStorage
's 5MB limit[2] - Consider that cached data in browser storage might be cleared if users clear their cache or browsing data[8]
It's worth noting that the Figma desktop app stores its cache in specific locations that can be cleared if needed:
- On Mac:
$HOME/Library/Application Support/Figma/Desktop
andDesktopProfile
[8] - On Windows:
%APPDATA%\Figma\DesktopProfile
[8]
For plugin developers concerned about data security, it's recommended that plugins should ideally not store sensitive data or process information on third-party services, as plugins can access significant amounts of file data[4].
Citations: [1] https://www.reddit.com/r/FigmaDesign/comments/11bjh5u/hello_how_can_i_know_where_figma_store_cache_file/ [2] https://www.figma.com/plugin-docs/api/figma-clientStorage/ [3] https://forum.figma.com/ask-the-community-7/how-do-i-clear-plugins-from-my-local-storage-11384 [4] https://annaerbetta.com/are-figmas-widgets-and-plugins-compromising-your-companys-data-heres-how-to-secure-your-data/ [5] https://forum.getkirby.com/t/where-is-the-best-place-to-store-plugin-cache-data/6733 [6] https://stackoverflow.com/questions/71028240/how-can-i-access-figma-clientstorage-in-a-figma-plugin-ui [7] https://magicul.io/figma-design-backup [8] https://help.figma.com/hc/en-us/articles/360040328553-What-can-I-do-offline-in-Figma [9] https://figma2wp.com/quantum-enhanced-wordpress-cache-management-strategies/ [10] https://rojcyk.com/blog/what-i-learned-creating-my-first-figma-plugin/ [11] https://help.transifex.com/en/articles/6213576-figma-plugin [12] https://www.figma.com/plugin-docs/api/properties/nodes-setplugindata/ [13] https://gist.github.com/gavinmcfarland/c2fd4c8b9f038a4f7f69c0dc75b632af [14] https://www.figma.com/plugin-docs/ [15] https://www.figma.com/plugin-docs/api/Variable/ [16] https://help.figma.com/hc/en-us/articles/16354660649495-Security-disclosure-principles
Answer from Perplexity: pplx.ai/share