Edit in GitHubLog an issue

require('uxp').storage.Entry

An Entry is the base class for File and Folder. You'll typically never instantiate an Entry directly, but it provides the common fields and methods that both File and Folder share.

Entry(name, provider, id)#

Creates an instance of Entry.

ParamType
name*
provider*
id*

isEntry : boolean#

Indicates that this instance is an Entry. Useful for type-checking.

Example

Copied to your clipboard
1if (something.isEntry) {
2 return something.getMetadata();
3}

isFile : boolean#

Read only Indicates that this instance is not a File. Useful for type- checking.

Example

Copied to your clipboard
1if (!anEntry.isFile) {
2 return "This entry is not a file.";
3}

isFolder : boolean#

Read only Indicates that this instance is not a folder. Useful for type- checking.

Example

Copied to your clipboard
1if (!anEntry.isFolder) {
2 return "This entry is not a folder.";
3}

name : string#

Read only The name of this entry. Read-only.

Example

Copied to your clipboard
console.log(anEntry.name);

provider : FileSystemProvider#

Read only The associated provider that services this entry. Read-only.

Example

Copied to your clipboard
1if (entryOne.provider !== entryTwo.provider) {
2 throw new Error("Providers are not the same");
3}

url : string#

Read only The url of this entry. You can use this url as input to other entities of the extension system like for eg: set as src attribute of a Image widget in UI. Read-only.

Example

Copied to your clipboard
console.log(anEntry.url);

nativePath : string#

Read only The platform native file-system path of this entry. Read-only

Example

Copied to your clipboard
console.log(anEntry.nativePath);

toString()#

returns the details of the given entry like name, type and native path in a readable string format.

copyTo(folder, options)#

Copies this entry to the specified folder.

Throws:

  • EntryExists if the attempt would overwrite an entry and overwrite is false
  • PermissionDenied if the underlying file system rejects the attempt
  • OutOfSpace if the file system is out of storage space
ParamTypeDefaultDescription
folderFolderthe folder to which to copy this entry
options*
[options.overwrite]booleanfalseif true, allows overwriting existing entries

Example

Copied to your clipboard
await someFile.copyTo(someFolder);

Example

Copied to your clipboard
await someFile.copyTo(someFolder, {overwrite: true});

Example

Copied to your clipboard
await someFolder.copyTo(anotherFolder, {overwrite: true});

moveTo(folder, options)#

Moves this entry to the target folder, optionally specifying a new name.

ParamTypeDefaultDescription
folderFolderthe folder to which to move this entry
options*
[options.overwrite]booleanfalseIf true allows the move to overwrite existing files
[options.newName]stringIf specified, the entry is renamed to this name

Example

Copied to your clipboard
await someFile.moveTo(someFolder);

Example

Copied to your clipboard
await someFile.moveTo(someFolder, {overwrite: true});

Example

Copied to your clipboard
await someFolder.moveTo(anotherFolder, {overwrite: true});

Example

Copied to your clipboard
await someFile.moveTo(someFolder, {newName: 'masterpiece.txt'})

Example

Copied to your clipboard
await someFile.moveTo(someFolder, {newName: 'novel.txt', {overwrite: true})

delete()#

Removes this entry from the file system. If the entry is a folder, all the contents will also be removed.

Example

Copied to your clipboard
await aFile.delete();

getMetadata()#

Returns this entry's metadata.

Returns: Promise.<EntryMetadata>
Example

Copied to your clipboard
const metadata = aFile.getMetadata();
Copyright © 2021 Adobe. All rights reserved.