Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CRCloudRail.setAppKey("CLOUDRAIL_API_KEY")
- //let cloudStorage : BusinessCloudStorageProtocol = Backblaze.init(accountID: "[account_id]", appKey: "[app_key]")
- //let cloudStorage : BusinessCloudStorageProtocol = Rackspace.init(username: "[username]", apiKey: "[api_key]", region: "[region]")
- //let cloudStorage : BusinessCloudStorageProtocol = MicrosoftAzure.init(accountName: "[account_name]", accessKey: "access_key")
- let cloudStorage : BusinessCloudStorageProtocol = AmazonS3.init(accessKeyId: "[access_key]", secretAccessKey: "[secret_key]", region: "[region]")
- let bucket : CRBucket = CRBucket.init()
- bucket.name = "[bucketName]";
- bucket.identifier = "[identifier]"
- let path = Bundle.main.path(forResource: "UserData", ofType: "csv")!
- let fileAttributes = try! FileManager.default.attributesOfItem(atPath: path)
- let fileSize: UInt64 = fileAttributes[FileAttributeKey.size] as! UInt64
- let stream = InputStream.init(fileAtPath: path)!
- do{
- try cloudStorage.uploadFileToBucket(bucket, name: "[fileName]", stream: stream, size:fileSize)
- } catch let error{
- print("An error: \(error)")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement