# Using require("uxp").storage always returns an empty object

**URL:** <https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709>\
**Category:** UXP Plugin API\
**Tags:** react\
**Created:** [March 15, 2019, 4:04pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709 "2019-03-15T16:04:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobMehew](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/robmehew/32/316_2.png) [@RobMehew](https://forums.creativeclouddeveloper.com/u/RobMehew)\
**Post date:** [March 15, 2019, 4:04pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/1 "2019-03-15T16:04:09Z")

</div>

Hi,

I have searched the forum a bit and I did see a post about the local file storage not being available to the public ([["localStorage" and "sessionStorage" will not ship to the public in October](http://forums.creativeclouddeveloper.com/t/localstorage-and-sessionstorage-will-not-ship-to-the-public-in-october/168)]) I’m not sure if that is related or not.

Every time I do a check on .storage or .localFileSystem they return an empty object {}.

Any good resources or tips you can share would be awesome!

Best regards  
Rob.

---

<div class="post-metadata">

**Author:** ![stevekwak](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/stevekwak/32/48_2.png) [@stevekwak](https://forums.creativeclouddeveloper.com/u/stevekwak)\
**Post date:** [March 15, 2019, 4:20pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/2 "2019-03-15T16:20:41Z")

</div>

Hi @RobMehew,

`localStorage` and `sessionStorage` are common Browser properties that are not available in XD. However, I think what you are asking / need is different from that. If you are looking for a way to store files locally, using `require("uxp").storage.localFileSystem` is still the recommended way. If you are looking for a sample, take a look at [https://github.com/AdobeXD/plugin-samples/tree/279ca7d965cd0b5f055d7e1deff8974b3b2ec075/how-to-export-a-rendition](https://github.com/AdobeXD/plugin-samples/tree/279ca7d965cd0b5f055d7e1deff8974b3b2ec075/how-to-export-a-rendition). Please let us know if you still run into any problems.

---

<div class="post-metadata">

**Author:** ![RobMehew](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/robmehew/32/316_2.png) [@RobMehew](https://forums.creativeclouddeveloper.com/u/RobMehew)\
**Post date:** [March 15, 2019, 4:23pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/3 "2019-03-15T16:23:49Z")

</div>

Thanks for the link, I’ll give it a shot and see how I go 🙂

I did think I was making the wrong connection with localStorage and sessionStorage, my bad!

---

<div class="post-metadata">

**Author:** ![RobMehew](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/robmehew/32/316_2.png) [@RobMehew](https://forums.creativeclouddeveloper.com/u/RobMehew)\
**Post date:** [March 15, 2019, 4:26pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/4 "2019-03-15T16:26:04Z")

</div>

Oops I should of mentioned I’m looking at trying to access pluginData folder to save settings for my plugin. If there are any examples around for that specifically that would be awesome, but I’m going to go through the link you sent too 🙂

---

<div class="post-metadata">

**Author:** ![stevekwak](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/stevekwak/32/48_2.png) [@stevekwak](https://forums.creativeclouddeveloper.com/u/stevekwak)\
**Post date:** [March 15, 2019, 5:34pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/5 "2019-03-15T17:34:27Z")

</div>

I think what you meant is the plugin folder not `pluginData`. Take a look at this line of this example: [https://github.com/AdobeXD/plugin-samples/blob/86bbfa2865bffec2035b33dda3511e0861d8ac7f/e2e-colorize-text/dialogs.js#L30](https://github.com/AdobeXD/plugin-samples/blob/86bbfa2865bffec2035b33dda3511e0861d8ac7f/e2e-colorize-text/dialogs.js#L30)

---

<div class="post-metadata">

**Author:** ![RobMehew](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/robmehew/32/316_2.png) [@RobMehew](https://forums.creativeclouddeveloper.com/u/RobMehew)\
**Post date:** [March 15, 2019, 5:39pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/6 "2019-03-15T17:39:50Z")

</div>

Thank you, I’ll take a look.

I was looking at: [https://adobexdplatform.com/plugin-docs/reference/uxp/storage-index.html](https://adobexdplatform.com/plugin-docs/reference/uxp/storage-index.html) inside the second code block there is a reference to

```auto
const pluginDataFolder = await fs.getDataFolder();

```

Which is what I meant by pluginData, I forgot the folder bit, oops!

Thanks for the help 🙂

---

<div class="post-metadata">

**Author:** ![RobMehew](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/robmehew/32/316_2.png) [@RobMehew](https://forums.creativeclouddeveloper.com/u/RobMehew)\
**Post date:** [March 15, 2019, 6:44pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/7 "2019-03-15T18:44:35Z")

</div>

What I think I’m not understanding is that everything appears to be returning a lot of empty objects.

```auto
{ localFileSystem: {},
  domains: 
   { userDesktop: {},
     userDocuments: {},
     userPictures: {},
     userVideos: {},
     userMusic: {},
     appLocalData: {},
     appLocalLibrary: {},
     appLocalCache: {},
     appLocalShared: {},
     appLocalTemporary: {},
     appRoamingData: {},
     appRoamingLibrary: {} },
  types: { file: {}, folder: {} },
  formats: { utf8: {}, binary: {} },
  modes: { readOnly: {}, readWrite: {} },
  fileTypes: 
   { text: ['txt', 'md'],
     images: ['png', 'gif', 'bmp', 'jpg'],
     all: ['*'] },
  errors: 
   { AbstractMethodInvocationError: [Function: b],
     ProviderMismatchError: [Function: b],
     EntryIsNotAnEntryError: [Function: b],
     EntryIsNotAFolderError: [Function: b],
     EntryIsNotAFileError: [Function: b],
     NotAFileSystemError: [Function: b],
     OutOfSpaceError: [Function: b],
     PermissionDeniedError: [Function: b],
     EntryExistsError: [Function: b],
     FileIsReadOnlyError: [Function: b],
     DomainNotSupportedError: [Function: b],
     InvalidFileNameError: [Function: b] } }

```

Is this normal if you console.log uxp ?

---

<div class="post-metadata">

**Author:** ![stevekwak](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/stevekwak/32/48_2.png) [@stevekwak](https://forums.creativeclouddeveloper.com/u/stevekwak)\
**Post date:** [March 15, 2019, 9:12pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/8 "2019-03-15T21:12:04Z")

</div>

Yes, that’s normal. The current debug console can only log enumerable properties, so if there is none present, it shows as an empty object. The future debugger will be much better than this! (expected to be available XD 20/21)

---

<div class="post-metadata">

**Author:** ![RobMehew](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/robmehew/32/316_2.png) [@RobMehew](https://forums.creativeclouddeveloper.com/u/RobMehew)\
**Post date:** [March 15, 2019, 9:15pm UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/9 "2019-03-15T21:15:37Z")

</div>

Just to update, managed to get everything working as intended, thanks for the help!

---

<div class="post-metadata">

**Author:** ![dalumiller](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@dalumiller](https://forums.creativeclouddeveloper.com/u/dalumiller)\
**Post date:** [April 24, 2020, 2:53am UTC](https://forums.creativeclouddeveloper.com/t/using-require-uxp-storage-always-returns-an-empty-object/709/10 "2020-04-24T02:53:28Z")

</div>

Hey Rob, can you share what you get to work? I too am only getting an empty object, regardless if I call getDataFolder or getPluginFolder. I’m testing using the console from the plugins develop folder. Is that an issue?
