The Files component is an abstraction of file storage with a default implementation using AWS S3. This also provides a much simplified API while making the underlying implementation swappable.
| Section | Component | Description |
| 1 | Status | Current status of this component |
| 2 | Install | Installation instructions and references to sources |
| 3 | Requires | Lists all the Slate Kit and third-party dependencies |
| 4 | Import | Packages to import |
| 5 | Setup | Set up of credentials, and configuration |
| 6 | Usage | Usage and examples |
This component is currently stable. However it is currently using the AWS 1.0 sdk that is synchonous. A future version will involve using AWS 2.0 sdk that is Async and incorporate Coroutines.
Back to top
repositories {
// other repositories
maven { url "http://dl.bintray.com/codehelixinc/slatekit" }
}
dependencies {
// other dependencies ...
compile 'com.slatekit:slatekit-cloud:1.0.0'
}| package | slatekit.cloud |
| jar | slatekit.cloud.jar |
| git | slatekit/src/lib/kotlin/slatekit-cloud |
| docs | Files |
| uses | slatekit.results, slatekit.core, slatekit.cloud |
| license | Apache 2.0 |
| example | Example_Files.kt |
This component uses the following other Slate Kit and/or third-party components.
| Component | Description |
| Results | To model successes and failures with optional status codes |
| Utils | Common utilities for both android + server |
import slatekit.cloud.aws.AwsCloudFiles
// Not storing any key/secret in source code for security purposes
// Setup 1: Use the default aws config file in "{user_dir}/.aws/credentials"
val files1 = AwsCloudFiles("app1-files-1", "slatekit", false)
// Setup 2: Use the type safe config in "{user_id}/myapp/conf/files.conf"
// Specify the api key section as "sqs"
val files2 = AwsCloudFiles("app1-files-1", "slatekit",false, "user://myapp/conf/files.conf", "s3")
// Setup 2: Use the type safe config in "{user_id}/myapp/conf/files.conf"
// Specify the api key section as "sqs"
val files3 = AwsCloudFiles("app1-queue-1", "slatekit",false, "user://myapp/conf/files.conf", "s3-1")
// Use case 1: Connect using parameters
files1.init()
// Use case 2: create using just name and content
files1.create("2016_nba_v3", "version 1")
// Use case 3: update using just name and content
files1.update("2016_nba_v3", "version 2")
// Use case 4: create using folder and file name
files1.create("2016_nba_v3", "chi", "version 1")
// Use case 5: update using folder and file name
files1.update("2016_nba_v3", "chi", "version 2")
// Use case 6: get file as a text using just name
files1.getAsText("2016_nba_v3")
// Use case 7: get file using folder and file name
files1.getAsText("2016_nba_v3", "chi")
// Use case 8: download file to local folder
files1.download("2016_nba_v3", "~/dev/temp/")
// Use case 9: download using folder and file name to local folder
files1.download("2016_nba_v3", "chi", "~/dev/temp")
// Use case 10: delete file by just the name
files1.delete("2016_nba_v3")
// Use case 11: delete using folder and name
files1.delete("2016_nba_v3", "chi")