Skip to content

Class VirtualFile

Source: virtualFile.ts

A virtual file that can be stored inside a folder

Extends

  • VirtualBase

Extended by

Accessors

absolutePath

Get Signature

get absolutePath(): string

Returns path without using any aliases

Returns

string

Inherited from

VirtualBase.absolutePath


canBeEdited

Get Signature

get canBeEdited(): boolean

Returns whether this can be edited in its current state

Returns

boolean

Inherited from

VirtualBase.canBeEdited


displayPath

Get Signature

get displayPath(): string

Returns path without using this item's alias

Returns

string

Inherited from

VirtualBase.displayPath


id

Get Signature

get id(): string

Returns

string

Overrides

VirtualBase.id


path

Get Signature

get path(): string

Returns the path of this item

Returns

string

Inherited from

VirtualBase.path

Constructors

Constructor

new VirtualFile(name: string, extension?: string): VirtualFile

Parameters

name

string

extension?

string

Returns

VirtualFile

Overrides

VirtualBase.constructor

Methods

confirmChanges()

confirmChanges(root?: VirtualRoot): void

Parameters

root?

VirtualRoot

Returns

void

Inherited from

VirtualBase.confirmChanges


delete()

delete(): void

Tries to delete this item

Returns

void

Inherited from

VirtualBase.delete


download()

download(): void

Returns

void


emit()

emit<Key>(eventName: Key, data?: unknown): void

Dispatch event

Type Parameters

Key

Key extends string

Parameters

eventName

Key

data?

unknown

Returns

void

Inherited from

VirtualBase.emit


getIconUrl()

getIconUrl(): string

Returns

string

Overrides

VirtualBase.getIconUrl


getRoot()

getRoot(): VirtualRoot

Returns the root folder

Returns

VirtualRoot

Inherited from

VirtualBase.getRoot


getType()

getType(): string

Returns

string

Overrides

VirtualBase.getType


isDownloadable()

isDownloadable(): boolean

Returns

boolean


isFile()

isFile(): boolean

Returns

boolean

Overrides

VirtualBase.isFile


isFolder()

isFolder(): boolean

Returns

boolean

Inherited from

VirtualBase.isFolder


off()

off<Key>(eventName: Key, callback: Listener): void

Remove event listener for an event

Type Parameters

Key

Key extends string

Parameters

eventName

Key

callback

Listener

Returns

void

Inherited from

VirtualBase.off


on()

on<Key>(eventName: Key, callback: Listener): Listener

Add event listener for an event

Type Parameters

Key

Key extends string

Parameters

eventName

Key

callback

Listener

Returns

Listener

Inherited from

VirtualBase.on


open()

open(windowsManager: WindowsManager): object | null

Opens this file in an app associated with its extension

Parameters

windowsManager

WindowsManager

Returns

object | null

Overrides

VirtualBase.open


read()

read(): Promise<OptionalStringProperty>

Returns

Promise<OptionalStringProperty>


removeFileScheme()

static removeFileScheme(source: string): string

Parameters

source

string

Returns

string


setAlias()

setAlias(alias: string): this

Parameters

alias

string

Returns

this

Overrides

VirtualBase.setAlias


setContent()

setContent(content: string | string[]): this

Sets the content of this file and removes the source

Parameters

content

string | string[]

Returns

this


setIconUrl()

setIconUrl(iconUrl: string | null): this

Parameters

iconUrl

string | null

Returns

this

Inherited from

VirtualBase.setIconUrl


setName()

setName(name: string): this

Parameters

name

string

Returns

this

Inherited from

VirtualBase.setName


setParent()

setParent(parent: VirtualFolder): this

Parameters

parent

VirtualFolder

Returns

this

Inherited from

VirtualBase.setParent


setProtected()

setProtected(value: boolean): this

Parameters

value

boolean

Returns

this

Inherited from

VirtualBase.setProtected


setSource()

setSource(source: string): this

Sets the source of this file and removes the content

Parameters

source

string

Returns

this


splitId()

static splitId(id: string): { extension: OptionalStringProperty; name: string; }

Parameters

id

string

Returns

{ extension: OptionalStringProperty; name: string; }

extension

extension: OptionalStringProperty

name

name: string


toJSON()

toJSON(): VirtualFileJson | null

Returns

VirtualFileJson | null

Overrides

VirtualBase.toJSON


toString()

toString(): string | null

Returns a string representation of an object.

Returns

string | null

Inherited from

VirtualBase.toString

Properties

alias

alias: string | null | undefined

The alias of this item

Inherited from

VirtualBase.alias


content

content: OptionalStringProperty

The content of this file


editedByUser

editedByUser: boolean | null | undefined

Whether this item has been edited by the user

Inherited from

VirtualBase.editedByUser


EVENT_NAMES

static EVENT_NAMES: { contentChange: string; update: string; }

contentChange

contentChange: string = "contentchange"

update

update: string = "update"

Overrides

VirtualBase.EVENT_NAMES


extension

extension: OptionalStringProperty

The extension of this file


iconUrl

iconUrl: string | null | undefined

The URL of the icon of this item

Inherited from

VirtualBase.iconUrl


isDeleted

isDeleted: boolean

Whether this item has been deleted

Inherited from

VirtualBase.isDeleted


isProtected

isProtected: boolean | null | undefined

Whether this item is protected from changes

Inherited from

VirtualBase.isProtected


isRoot

isRoot: boolean | null | undefined

Whether this item is the root folder

Inherited from

VirtualBase.isRoot


linkedFile

linkedFile: VirtualFile | null | undefined

The file this item links to

Inherited from

VirtualBase.linkedFile


linkedFolder

linkedFolder: VirtualFolder | null | undefined

The folder this item links to

Inherited from

VirtualBase.linkedFolder


name

name: string

The name of this item

Inherited from

VirtualBase.name


NON_TEXT_EXTENSIONS

static NON_TEXT_EXTENSIONS: string[]


parent

parent: VirtualFolder | null | undefined

The folder this item is in

Inherited from

VirtualBase.parent


root

root: VirtualRoot | null | undefined

The root folder

Inherited from

VirtualBase.root


source

source: OptionalStringProperty

The URL of the source of this file

Built by Prozilla