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]) 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.
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. Please let us know if you still run into any problems.
1 Like
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!
1 Like
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
Thank you, I’ll take a look.
I was looking at: https://adobexdplatform.com/plugin-docs/reference/uxp/storage-index.html inside the second code block there is a reference to
const pluginDataFolder = await fs.getDataFolder();
Which is what I meant by pluginData, I forgot the folder bit, oops!
Thanks for the help
What I think I’m not understanding is that everything appears to be returning a lot of empty objects.
{ 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 ?
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)
2 Likes
Just to update, managed to get everything working as intended, thanks for the help!
3 Likes
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?