common-plugin / com.cognifide.gradle.common.file.transfer.generic / CustomFileTransfer

CustomFileTransfer

class CustomFileTransfer : ProtocolFileTransfer

Represents dynamically created file transfer via build script.

Allows to implement file transfer supporting cloud storage like Amazon S3, Google Cloud Storage etc and use them for uploading, downloading and listing files.

Constructors

<init>

Represents dynamically created file transfer via build script.

CustomFileTransfer(common: CommonExtension)

Properties

name

Unique identifier.

lateinit var name: String

parallelable

Determines if operations using this transfer could be done in parallel.

var parallelable: Boolean

protocols

lateinit var protocols: List<String>

Functions

delete

Register callback responsible for deleting file.

fun delete(callback: (dirUrl: String, fileName: String) -> Unit): Unit

deleteFrom

Deletes file of given name in directory available at specified URL.

fun deleteFrom(dirUrl: String, fileName: String): Unit

download

Register callback responsible for downloading file.

fun download(callback: (dirUrl: String, fileName: String, target: File) -> Unit): Unit

downloadFrom

Downloads file with given name from directory available at specified URL.

fun downloadFrom(dirUrl: String, fileName: String, target: File): Unit

exists

Register callback responsible for checking file existence.

fun exists(callback: (dirUrl: String, fileName: String) -> Boolean): Unit

Checks if file with given name exists in directory at specified URL.

fun exists(dirUrl: String, fileName: String): Boolean

list

Register callback responsible for listing files.

fun list(callback: (dirUrl: String) -> List<FileEntry>): Unit

Lists files in directory available at specified URL.

fun list(dirUrl: String): List<FileEntry>

truncate

Register callback responsible for deleting files.

fun truncate(callback: (dirUrl: String) -> Unit): Unit

Deletes all files in directory available at specified URL.

fun truncate(dirUrl: String): Unit

upload

Register callback responsible for uploading file.

fun upload(callback: (dirUrl: String, fileName: String, target: File) -> Unit): Unit

uploadTo

Uploads file to directory available at specified URL and set given name.

fun uploadTo(dirUrl: String, fileName: String, source: File): Unit