ballerina/internal module
Records Summary
Record | Description | ||
---|---|---|---|
CompressionError | Represent all compression related errors. |
Objects Summary
Object | Description | ||
---|---|---|---|
Path | Reference to the file location. |
Functions Summary
Return Type | Function and Description | ||
---|---|---|---|
error?<> | compress(internal:Path dirPath, internal:Path destDir) Compresses a directory. |
||
byte[]|error<> | compressToByteArray(internal:Path dirPath) Compresses a directory into a byte array. |
||
error?<> | decompress(internal:Path dirPath, internal:Path destDir) Decompresses a compressed file. |
||
error?<> | decompressFromByteArray(byte[] content, internal:Path destDir) Decompresses a byte array into a directory. |
||
string|error<> | execBallerinaDoc(string[] moduleList, string? sourceRoot, string? outputPath, string? templatesPath, string[]? exclude, boolean includeNatives, map<string>? envVars, string? config, boolean verbose) Executes a ballerina doc command |
Constants
public type CompressionError record
Represent all compression related errors.
Field Name | Data Type | Default Value | Description |
---|---|---|---|
message | string | The error message |
public function compress(internal:Path dirPath, internal:Path destDir) returns (error?<>)
Compresses a directory.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
dirPath | internal:Path | Path of the directory to be compressed |
|
destDir | internal:Path | Path of the directory to place the compressed file |
Return Type | Description | ||
---|---|---|---|
error?<> | An error if an error occurs during the compression process |
public function compressToByteArray(internal:Path dirPath) returns (byte[]|error<>)
Compresses a directory into a byte array.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
dirPath | internal:Path | Path of the directory to be compressed |
Return Type | Description | ||
---|---|---|---|
byte[]|error<> | Compressed byte array of the file. An error if an error occurs during the compression process. |
public function decompress(internal:Path dirPath, internal:Path destDir) returns (error?<>)
Decompresses a compressed file.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
dirPath | internal:Path | Path of the compressed file |
|
destDir | internal:Path | Path of the directory to decompress the file |
Return Type | Description | ||
---|---|---|---|
error?<> | An error if an error occurs during the decompression process |
public function decompressFromByteArray(byte[] content, internal:Path destDir) returns (error?<>)
Decompresses a byte array into a directory.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
content | byte[] | Byte array of the compressed file |
|
destDir | internal:Path | Path of the directory to decompress the file |
Return Type | Description | ||
---|---|---|---|
error?<> | An error if an error occurs during the decompression process |
public function execBallerinaDoc(string[] moduleList, string? sourceRoot, string? outputPath, string? templatesPath, string[]? exclude, boolean includeNatives, map<string>? envVars, string? config, boolean verbose) returns (string|error<>)
Executes a ballerina doc command
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
moduleList | string[] | List of modules |
|
sourceRoot | string? | () | Root folder of the modules |
outputPath | string? | () | Path to write api-docs |
templatesPath | string? | () | Location of the templates |
exclude | string[]? | () | Modules to exclude |
includeNatives | boolean | false | Generate docs for natives |
envVars | map |
() | Environment variables to pass |
config | string? | () | Path to configuration file |
verbose | boolean | false | Verbose mode |
Return Type | Description | ||
---|---|---|---|
string|error<> | Data piped from the standard output and error output of the process |
public type Path object
Reference to the file location.
-
<Path> __init(string root)
Parameter Name Data Type Default Value Description root string -
<Path> getPathValue() returns (string)
Retreives the absolute path from the provided location.
Return Type Description string Returns the absolute path as a string
-
<Path> getName() returns (string)
Retreives the name of the file from the provided location.
Return Type Description string Returns the name of the file
-
<Path> getExtension() returns (string)
Retreives the extension of the file from the provided location.
Return Type Description string Returns the extension of the file. Empty string if no extension.
-
<Path> exists() returns (boolean)
Check for existance of the file.
Return Type Description boolean True if the file exists, else false
-
<Path> list() returns (Path[]|error<>)
Returns the files of folders in the directory.
Return Type Description Path[]|error<> True if the given file path is a directory. It is false otherwise
-
<Path> isDirectory() returns (boolean)
Check if given file is a directory
Return Type Description boolean True if directory, else false
-
<Path> delete() returns (error?<>)
Deletes a file/directory.
Return Type Description error?<> Error if the directory/file could not be deleted
-
<Path> createDirectory() returns (error?<>)
Creates a directory.
Return Type Description error?<> Error if the directory could not be created
-
<Path> createFile() returns (error?<>)
Creates a file.
Return Type Description error?<> Error if the file could not be created
-
<Path> getModifiedTime() returns (time:Time|error<>)
Retrieves the last modified time of the file of directory.
Return Type Description time:Time|error<> Last modified time or an error if the path cannot be resolved
-
<Path> copyTo(internal:Path target) returns (error?<>)
Copy file or directory to another path.
Parameter Name Data Type Default Value Description target internal:Path The location to copy file or directory
Return Type Description error?<> Error if the file could not be copied
-
<Path> moveTo(internal:Path target) returns (error?<>)
Move file or directory to another path.
Parameter Name Data Type Default Value Description target internal:Path The location to move file or directory
Return Type Description error?<> Error if the file could not be moved
-
<Path> getParentDirectory() returns (Path|error<>)
Get the enclosing parent directory.
Return Type Description Path|error<> Path of parent folder or error occurred while getting parent directory
-
<Path> resolve(string[] paths) returns (Path)
Resolve given path.
Parameter Name Data Type Default Value Description paths string[] Paths to be resolved within the current path
Return Type Description Path Resolved path