platform/workspace
Documentation
- source: platform/workspace.ts
Overview
Classes
Workspace
createWorkspace()
Creates a new workspace with the given name.
tsstatic createWorkspace(name: string): Workspace;
Parameter Type Description namestringThe name of the workspace to create. Returns
- Type:
Workspace- Description: The newly created Workspace instance.
getWorkspace()
Retrieves an existing workspace by name.
tsstatic getWorkspace(name: string): Workspace;
Parameter Type Description namestringThe name of the workspace to retrieve. Returns
- Type:
Workspace- Description: The Workspace instance.
getWorkspacesNames()
Retrieves the names of all existing workspaces.
tsstatic getWorkspacesNames(): void;Returns
- Type:
void- Description: An array of workspace names.
deleteWorkspace()
Deletes the workspace with the specified name.
tsstatic deleteWorkspace(name: string): void;
Parameter Type Description namestringThe name of the workspace to delete. Returns
- Type:
void- Description:
getProjects()
Gets a collection of all projects within this workspace.
tsgetProjects(): Projects;Returns
- Type:
Projects- Description: A Projects collection instance.
createProject()
Creates a new project within this workspace.
tscreateProject(name: string): Project;
Parameter Type Description namestringThe name of the project to create. Returns
- Type:
Project- Description: The newly created Project instance.
getProject()
Retrieves an existing project by name from this workspace.
tsgetProject(name: string): Project;
Parameter Type Description namestringThe name of the project to retrieve. Returns
- Type:
Project- Description: The Project instance.
deleteProject()
Deletes a project from this workspace by name.
tsdeleteProject(name: string): void;
Parameter Type Description namestringThe name of the project to delete. Returns
- Type:
void- Description:
exists()
Checks if the workspace currently exists.
tsexists(): boolean;Returns
- Type:
boolean- Description: True if the workspace exists, false otherwise.
existsFolder()
Checks if a specific folder path exists within the workspace's filesystem structure.
tsexistsFolder(path: string): boolean;
Parameter Type Description pathstringThe relative path to the folder. Returns
- Type:
boolean- Description: True if the folder exists.
existsFile()
Checks if a specific file path exists within the workspace's filesystem structure.
tsexistsFile(path: string): boolean;
Parameter Type Description pathstringThe relative path to the file. Returns
- Type:
boolean- Description: True if the file exists.
copyProject()
Copies a project from a source name to a target name within the workspace.
tscopyProject(source: string, target: string): void;
Parameter Type Description sourcestringThe name of the project to copy. targetstringThe name of the new project copy. Returns
- Type:
void- Description:
moveProject()
Moves a project from a source name to a target name (renaming it).
tsmoveProject(source: string, target: string): void;
Parameter Type Description sourcestringThe current name of the project. targetstringThe new name/path of the project. Returns
- Type:
void- Description:
Projects
size()
Gets the number of projects in the collection.
tssize(): number;Returns
- Type:
number- Description: The size of the collection.
get()
Gets a Project instance at the specified index.
tsget(index: number): Project;
Parameter Type Description indexnumberThe index of the project. Returns
- Type:
Project- Description: The Project instance.
Project
getName()
Gets the name of the project.
tsgetName(): string;Returns
- Type:
string- Description: The project name.
getPath()
Gets the path of the project.
tsgetPath(): string;Returns
- Type:
string- Description: The project path (relative to the repository/workspace root).
createFolder()
Creates a new folder within the project.
tscreateFolder(path: string): Folder;
Parameter Type Description pathstringThe path of the folder to create (relative to the project root). Returns
- Type:
Folder- Description: The newly created Folder instance.
exists()
Checks if the project itself exists.
tsexists(): boolean;Returns
- Type:
boolean- Description: True if the project exists.
existsFolder()
Checks if a specific folder path exists within the project.
tsexistsFolder(path: string): boolean;
Parameter Type Description pathstringThe relative path to the folder. Returns
- Type:
boolean- Description: True if the folder exists.
getFolder()
Retrieves a folder by its path relative to the project root.
tsgetFolder(path: string): Folder;
Parameter Type Description pathstringThe relative path to the folder. Returns
- Type:
Folder- Description: The Folder instance.
getFolders()
Retrieves a collection of folders at a specific path.
tsgetFolders(path: string): Folders;
Parameter Type Description pathstringThe path containing the folders to retrieve. Returns
- Type:
Folders- Description: The Folders collection instance.
deleteFolder()
Deletes a folder from the project.
tsdeleteFolder(path: string): void;
Parameter Type Description pathstringThe path of the folder to delete (relative to the project root). Returns
- Type:
void- Description:
createFile()
Creates a new file within the project.
tscreateFile(path: string, input: any): File;
Parameter Type Description pathstringThe path of the file to create (relative to the project root). inputanyOptional initial content as a byte array. Returns
- Type:
File- Description: The newly created File instance.
existsFile()
Checks if a specific file path exists within the project.
tsexistsFile(path: string): boolean;
Parameter Type Description pathstringThe relative path to the file. Returns
- Type:
boolean- Description: True if the file exists.
getFile()
Retrieves a file by its path relative to the project root.
tsgetFile(path: string): File;
Parameter Type Description pathstringThe relative path to the file. Returns
- Type:
File- Description: The File instance.
getFiles()
Retrieves a collection of files at a specific path.
tsgetFiles(path: string): Files;
Parameter Type Description pathstringThe path containing the files to retrieve. Returns
- Type:
Files- Description: The Files collection instance.
deleteFile()
Deletes a file from the project.
tsdeleteFile(path: string): void;
Parameter Type Description pathstringThe path of the file to delete (relative to the project root). Returns
- Type:
void- Description:
Folders
size()
Gets the number of folders in the collection.
tssize(): number;Returns
- Type:
number- Description: The size of the collection.
get()
Gets a Folder instance at the specified index.
tsget(index: number): Folder;
Parameter Type Description indexnumberThe index of the folder. Returns
- Type:
Folder- Description: The Folder instance.
Files
size()
Gets the number of files in the collection.
tssize(): number;Returns
- Type:
number- Description: The size of the collection.
get()
Gets a File instance at the specified index.
tsget(index: number): File;
Parameter Type Description indexnumberThe index of the file. Returns
- Type:
File- Description: The File instance.
Folder
getName()
Gets the name of the folder.
tsgetName(): string;Returns
- Type:
string- Description: The folder name.
getPath()
Gets the full path of the folder.
tsgetPath(): string;Returns
- Type:
string- Description: The folder path.
createFolder()
Creates a new sub-folder within this folder.
tscreateFolder(path: string): Folder;
Parameter Type Description pathstringThe path of the sub-folder to create (relative to this folder). Returns
- Type:
Folder- Description: The newly created Folder instance.
exists()
Checks if the folder itself exists.
tsexists(): boolean;Returns
- Type:
boolean- Description: True if the folder exists.
existsFolder()
Checks if a specific sub-folder path exists within this folder.
tsexistsFolder(path: string): boolean;
Parameter Type Description pathstringThe relative path to the sub-folder. Returns
- Type:
boolean- Description: True if the sub-folder exists.
getFolder()
Retrieves a sub-folder by its path relative to this folder.
tsgetFolder(path: string): Folder;
Parameter Type Description pathstringThe relative path to the sub-folder. Returns
- Type:
Folder- Description: The Folder instance.
getFolders()
Retrieves a collection of folders at a specific path relative to this folder.
tsgetFolders(path: string): Folders;
Parameter Type Description pathstringThe path containing the folders to retrieve. Returns
- Type:
Folders- Description: The Folders collection instance.
deleteFolder()
Deletes a sub-folder from this folder.
tsdeleteFolder(path: string): void;
Parameter Type Description pathstringThe path of the sub-folder to delete (relative to this folder). Returns
- Type:
void- Description:
createFile()
Creates a new file within this folder.
tscreateFile(path: string, input: any): File;
Parameter Type Description pathstringThe path of the file to create (relative to this folder). inputanyOptional initial content as a byte array. Returns
- Type:
File- Description: The newly created File instance.
existsFile()
Checks if a specific file path exists within this folder.
tsexistsFile(path: string): boolean;
Parameter Type Description pathstringThe relative path to the file. Returns
- Type:
boolean- Description: True if the file exists.
getFile()
Retrieves a file by its path relative to this folder.
tsgetFile(path: string): File;
Parameter Type Description pathstringThe relative path to the file. Returns
- Type:
File- Description: The File instance.
getFiles()
Retrieves a collection of files at a specific path relative to this folder.
tsgetFiles(path: string): Files;
Parameter Type Description pathstringThe path containing the files to retrieve. Returns
- Type:
Files- Description: The Files collection instance.
deleteFile()
Deletes a file from this folder.
tsdeleteFile(path: string): void;
Parameter Type Description pathstringThe path of the file to delete (relative to this folder). Returns
- Type:
void- Description:
File
getName()
Gets the name of the file.
tsgetName(): string;Returns
- Type:
string- Description: The file name.
getPath()
Gets the full path of the file.
tsgetPath(): string;Returns
- Type:
string- Description: The file path.
getContentType()
Gets the content type (MIME type) of the file.
tsgetContentType(): string;Returns
- Type:
string- Description: The content type string.
isBinary()
Checks if the file content is determined to be binary.
tsisBinary(): boolean;Returns
- Type:
boolean- Description: True if binary, false if text.
getContent()
Gets the content of the file as a JavaScript-friendly byte array.
tsgetContent(): void;Returns
- Type:
void- Description: The content bytes.
getText()
Gets the content of the file as a text string.
tsgetText(): string;Returns
- Type:
string- Description: The text content.
setContent()
Sets the content of the file using a byte array.
tssetContent(input: any): void;
Parameter Type Description inputanyThe new content bytes. Returns
- Type:
void- Description:
setText()
Sets the content of the file using a text string. The string is converted to a byte array before saving.
tssetText(input: string): void;
Parameter Type Description inputstringThe new text content. Returns
- Type:
void- Description:
exists()
Checks if the file exists.
tsexists(): boolean;Returns
- Type:
boolean- Description: True if the file exists.
