9.0 Released! → Native ESM runtimes 🚀, Vite support ⚡️, multi-window apps and more...
Read Announcement

Defined in: file-system/index.d.ts:221

Represents a Folder (directory) entity on the file system.

Extends

Constructors

Constructor

ts
new Folder(): Folder;

Returns

Folder

Inherited from

FileSystemEntity.constructor

Properties

isKnown

ts
isKnown: boolean;

Defined in: file-system/index.d.ts:225

Determines whether this instance is a KnownFolder (accessed through the KnownFolders object).


lastModified

ts
lastModified: Date;

Defined in: file-system/index.d.ts:31

Gets the Date object specifying the last time this entity was modified.

Inherited from

FileSystemEntity.lastModified


name

ts
name: string;

Defined in: file-system/index.d.ts:36

Gets the name of the entity.

Inherited from

FileSystemEntity.name


parent

ts
parent: Folder;

Defined in: file-system/index.d.ts:48

Gets the Folder object representing the parent of this entity. Will be null for a root folder like Documents or Temporary. This property is readonly.

Inherited from

FileSystemEntity.parent


path

ts
path: string;

Defined in: file-system/index.d.ts:41

Gets the fully-qualified path (including the extension for a File) of the entity.

Inherited from

FileSystemEntity.path

Methods

clear()

ts
clear(): Promise<any>;

Defined in: file-system/index.d.ts:249

Deletes all the files and folders (recursively), contained within this Folder.

Returns

Promise<any>


clearSync()

ts
clearSync(onError?: (error: any) => void): void;

Defined in: file-system/index.d.ts:255

Deletes all the files and folders (recursively), contained within this Folder synchronously.

Parameters

ParameterTypeDescription
onError?(error: any) => voidAn optional function to be called if some error occurs.

Returns

void


contains()

ts
contains(name: string): boolean;

Defined in: file-system/index.d.ts:244

Checks whether this Folder contains an Entity with the specified name. The path of the folder is added to the name to resolve the complete path to check for.

Parameters

ParameterTypeDescription
namestringThe name of the entity to check for.

Returns

boolean


eachEntity()

ts
eachEntity(onEntity: (entity: FileSystemEntity) => boolean): any;

Defined in: file-system/index.d.ts:284

Enumerates all the top-level FileSystem entities residing within this folder.

Parameters

ParameterTypeDescription
onEntity(entity: FileSystemEntity) => booleanA callback that receives the current entity. If the callback returns false this will mean for the iteration to stop.

Returns

any


getEntities()

ts
getEntities(): Promise<FileSystemEntity[]>;

Defined in: file-system/index.d.ts:272

Gets all the top-level entities residing within this folder.

Returns

Promise<FileSystemEntity[]>


getEntitiesSync()

ts
getEntitiesSync(onError?: (error: any) => any): FileSystemEntity[];

Defined in: file-system/index.d.ts:278

Gets all the top-level entities residing within this folder synchronously.

Parameters

ParameterTypeDescription
onError?(error: any) => anyAn optional function to be called if some error occurs.

Returns

FileSystemEntity[]


getFile()

ts
getFile(name: string): File;

Defined in: file-system/index.d.ts:261

Gets or creates a File entity with the specified name within this Folder.

Parameters

ParameterTypeDescription
namestringThe name of the file to get/create.

Returns

File


getFolder()

ts
getFolder(name: string): Folder;

Defined in: file-system/index.d.ts:267

Gets or creates a Folder entity with the specified name within this Folder.

Parameters

ParameterTypeDescription
namestringThe name of the folder to get/create.

Returns

Folder


remove()

ts
remove(): Promise<any>;

Defined in: file-system/index.d.ts:53

Removes (deletes) the current Entity from the file system.

Returns

Promise<any>

Inherited from

FileSystemEntity.remove


removeSync()

ts
removeSync(onError?: (error: any) => any): void;

Defined in: file-system/index.d.ts:58

Removes (deletes) the current Entity from the file system synchronously.

Parameters

ParameterType
onError?(error: any) => any

Returns

void

Inherited from

FileSystemEntity.removeSync


rename()

ts
rename(newName: string): Promise<any>;

Defined in: file-system/index.d.ts:64

Renames the current entity using the specified name.

Parameters

ParameterTypeDescription
newNamestringThe new name to be applied to the entity.

Returns

Promise<any>

Inherited from

FileSystemEntity.rename


renameSync()

ts
renameSync(newName: string, onError?: (error: any) => any): void;

Defined in: file-system/index.d.ts:70

Renames the current entity synchronously, using the specified name.

Parameters

ParameterTypeDescription
newNamestringThe new name to be applied to the entity.
onError?(error: any) => any-

Returns

void

Inherited from

FileSystemEntity.renameSync


exists()

ts
static exists(path: string): boolean;

Defined in: file-system/index.d.ts:237

Checks whether a Folder with the specified path already exists.

Parameters

ParameterTypeDescription
pathstringThe path to check for.

Returns

boolean


fromPath()

ts
static fromPath(path: string): Folder;

Defined in: file-system/index.d.ts:231

Gets or creates a Folder entity at the specified path.

Parameters

ParameterTypeDescription
pathstringThe path to get/create the folder at.

Returns

Folder

Next
Font