VFS Constructors
VirtualFS Constructor
new VirtualFS(
vfsType: VFSType, // mandatory
target: string, // mandatory
payload?: string // optional (see below)
)A new VirtualFileSystem object can be created using the new clause followed by the VirtualFS configuration.
Parameters
| Parameter | Type | Explanation |
|---|---|---|
vfsType | VFSType | One of: VfsTypeDisk, VfsTypeS3, VfsTypeAzure, VfsTypeGCS, VfsTypeSFTP |
target | string | The VFS target path/URL. Ex: C:\\Data or /var/data or s3://myS3bucket etc. |
payload | string | Additional data to connect to the target and use it (e.g., cloud auth credentials, etc.) |
Examples
Barebone example of creating a VirtualFileSystem pointing to a local file-system folder:
var vfs = new VirtualFS(VfsTypeDisk, "/var/Uploads"); // or C:\\Var\\Uploads in Windows
if (vfs != null) {
// use the vfs...
}Barebone example of creating a VirtualFileSystem pointing to an Amazon S3 bucket:
var vfs = new VirtualFS(
VfsTypeS3,
"s3://myS3bucket",
"{\"accessKey\":\"AKIA...\",\"secretKey\":\"...\"}"
);
if (vfs != null) {
// use the vfs...
}IMPORTANT
To learn everything you need to know about target and payload configurations, please, refer to the Virtual File System (VFS) section of this manual.
VirtualFSByName Constructor
new VirtualFSByName(
vfsName: string // mandatory
)A new VirtualFileSystem object can also be created by referencing the VFS name of an existing VFS configuration defined in Syncplify Server!.
Parameters
| Parameter | Type | Explanation |
|---|---|---|
vfsName | string | The name assigned to the VFS configuration by the system administrator |
Examples
Barebone example of creating a VirtualFileSystem by referencing an existing VFS configuration named uploads:
var vfs = new VirtualFSByName("uploads");
if (vfs != null) {
// use the vfs...
}IMPORTANT
VirtualFSByName is only available in Syncplify Server! v7.0.11 and later, and requires that the referenced VFS configuration is properly defined in the system by the administrator. For more information on how to define VFS configurations, please, refer to the Virtual File System (VFS) section of this manual.
