Skip to content

VFS Constructors

VirtualFS Constructor

ts
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

ParameterTypeExplanation
vfsTypeVFSTypeOne of: VfsTypeDisk, VfsTypeS3, VfsTypeAzure, VfsTypeGCS, VfsTypeSFTP
targetstringThe VFS target path/URL. Ex: C:\\Data or /var/data or s3://myS3bucket etc.
payloadstringAdditional 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:

ts
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:

ts
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

ts
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

ParameterTypeExplanation
vfsNamestringThe 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:

ts
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.