Class VirtualFile
Source: virtualFile.ts
A virtual file that can be stored inside a folder.
Extends
Extended by
Constructors
Constructor
new VirtualFile(
name:string,extension?:string):VirtualFile
Parameters
name
string
extension?
string
Returns
VirtualFile
Overrides
Properties
extension
extension:
OptionalStringProperty
The extension of this file.
source
source:
OptionalStringProperty
The URL of the source of this file.
content
content:
OptionalStringProperty
The content of this file.
NON_TEXT_EXTENSIONS
staticNON_TEXT_EXTENSIONS:string[]
CONTENT_CHANGE_EVENT
readonlystaticCONTENT_CHANGE_EVENT:"contentChange"="contentChange"
name
name:
string
The name of this item.
Inherited from
alias
alias:
string|null|undefined
The alias of this item.
Inherited from
parent
parent:
VirtualFolder<VirtualBaseEvents> |null|undefined
The folder this item is in.
Inherited from
isProtected
isProtected:
boolean|null|undefined
Whether this item is protected from changes.
Inherited from
iconUrl
iconUrl:
string|null|undefined
The URL of the icon of this item.
Inherited from
linkedFile
linkedFile:
VirtualFile|null|undefined
The file this item links to.
Inherited from
linkedFolder
linkedFolder:
VirtualFolder<VirtualBaseEvents> |null|undefined
The folder this item links to.
Inherited from
editedByUser
editedByUser:
boolean|null|undefined
Whether this item has been edited by the user.
Inherited from
isRoot
isRoot:
boolean|null|undefined
Whether this item is the root folder.
Inherited from
root
root:
VirtualRoot|null|undefined
The root folder.
Inherited from
isDeleted
isDeleted:
boolean
Whether this item has been deleted.
Inherited from
UPDATE_EVENT
readonlystaticUPDATE_EVENT:"update"="update"
Inherited from
Methods
setAlias()
setAlias(
alias:string):this
Parameters
alias
string
Returns
this
Overrides
setSource()
setSource(
source:string):this
Sets the source of this file and removes the content.
Parameters
source
string
Returns
this
setContent()
setContent(
content:string|string[]):this
Sets the content of this file and removes the source.
Parameters
content
string | string[]
Returns
this
splitId()
staticsplitId(id:string): {name:string;extension:OptionalStringProperty; }
Parameters
id
string
Returns
{ name: string; extension: OptionalStringProperty; }
name
name:
string
extension
extension:
OptionalStringProperty
open()
open(
windowsManager:WindowsManager):object|null
Opens this file in an app associated with its extension.
Parameters
windowsManager
Returns
object | null
Overrides
read()
read():
Promise<OptionalStringProperty>
Returns
Promise<OptionalStringProperty>
isFile()
isFile():
this is VirtualFile
Returns
this is VirtualFile
Overrides
getIconUrl()
getIconUrl():
string
Returns
string
Overrides
getType()
getType():
string
Returns
string
Overrides
download()
download():
void
Returns
void
isDownloadable()
isDownloadable():
boolean
Returns
boolean
toJSON()
toJSON():
VirtualFileJson|null
Returns
VirtualFileJson | null
Overrides
removeFileScheme()
staticremoveFileScheme(source:string):string
Parameters
source
string
Returns
string
setName()
setName(
name:string):this
Parameters
name
string
Returns
this
Inherited from
setParent()
setParent(
parent:VirtualFolder):this
Parameters
parent
Returns
this
Inherited from
setProtected()
setProtected(
value:boolean):this
Parameters
value
boolean
Returns
this
Inherited from
setIconUrl()
setIconUrl(
iconUrl:string|null):this
Parameters
iconUrl
string | null
Returns
this
Inherited from
delete()
delete():
void
Tries to delete this item.
Returns
void
Inherited from
confirmChanges()
confirmChanges(
root?:VirtualRoot):void
Parameters
root?
Returns
void
Inherited from
getRoot()
getRoot():
VirtualRoot
Returns the root folder.
Returns
Inherited from
isFolder()
isFolder():
this is VirtualFolder<VirtualBaseEvents>
Returns
this is VirtualFolder<VirtualBaseEvents>
Inherited from
toString()
toString():
string|null
Returns a string representation of an object.
Returns
string | null
Inherited from
on()
on<
K>(event:K,listener:Listener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>):Listener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>
Starts listening to an event.
Type Parameters
K
K extends keyof VirtualFileEvents
Parameters
event
K
The event to listen to.
listener
Listener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The function to call when the event is emitted.
Returns
Listener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The listener.
Inherited from
once()
once<
K>(event:K,listener:Listener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>):Listener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>
Registers an event listener that is automatically removed when called.
Type Parameters
K
K extends keyof VirtualFileEvents
Parameters
event
K
The event to listen to.
listener
Listener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The function to call once the event is emitted.
Returns
Listener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The wrapped listener.
Inherited from
onAsync()
onAsync<
K>(event:K,listener:AsyncListener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>,onRejected?: (reason:any) =>unknown|null):Listener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>
Starts listening to an event.
Type Parameters
K
K extends keyof VirtualFileEvents
Parameters
event
K
The event to listen to.
listener
AsyncListener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The function to call when the event is emitted.
onRejected?
(reason: any) => unknown | null
Returns
Listener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The wrapped listener.
Inherited from
off()
off<
K>(event:K,listener:Listener<VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>,K>):void
Removes an event listener.
Type Parameters
K
K extends keyof VirtualFileEvents
Parameters
event
K
The event to remove the listener from.
listener
Listener<VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>, K>
The listener to remove.
Returns
void
Inherited from
emit()
emit<
K>(event:K, ...args:VirtualFileEvents&Record<keyofVirtualFileEvents,unknown[]>[K]):void
Emits an event to all its listeners.
Type Parameters
K
K extends keyof VirtualFileEvents
Parameters
event
K
The event to emit.
args
...VirtualFileEvents & Record<keyof VirtualFileEvents, unknown[]>[K]
The arguments to pass to the listeners.
Returns
void
Inherited from
Accessors
id
Get Signature
get id():
string
Returns
string
Overrides
path
Get Signature
get path():
string
Returns the path of this item.
Returns
string
Inherited from
displayPath
Get Signature
get displayPath():
string
Returns path without using this item's alias.
Returns
string
Inherited from
absolutePath
Get Signature
get absolutePath():
string
Returns path without using any aliases.
Returns
string
Inherited from
canBeEdited
Get Signature
get canBeEdited():
boolean
Returns whether this can be edited in its current state.
Returns
boolean