LocalFileManager 0.1.5

LocalFileManager 0.1.5

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2017
SwiftSwift Version 3.x
SPMSupports SPM

Maintained by asashin227.



  • By
  • Asakura Shinsuke




LocalFileManager is Wrapped FileManager so that it can be used easily.

TODO

  • Add comment
  • Genarate Thumbnail image
  • Throw correct error
  • Use Optional correctly
  • Test

Usage

Howto display all files under the path.

let fileManager = LocalFileManager()
let dirPath = try! fileManager.absolutePath(.libraryDirectory)
let files = try! fileManager.files(at: directoryPath)!
files.forEach() {
	file in
	
	let fileName = file.name
	let path = file.path!
	let data = file.data!
}

Manage file.

 let fileManager = LocalFileManager()

 // Load file.
 let filePath = try! fileManager.absolutePath(.libraryDirectory, path: "/hoge/fuga/img.png")
 let file = try! File(path: filePath)
 
  // Delete file. 
 try! fileManager.delete(file)
 
 // Save file.
 try! fileManager.save(file)
 
 // Copy file. 
 let copyPath = try! fileManager.absolutePath(.libraryDirectory, path: "/hoge/fuga/img.png")
 let copiedFile = try! fileManager.copy(file, to: copyPath)

Requirements

  • iOS 8.0 or later

Installation

LocalFileManager is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "LocalFileManager"

Author

asashin227

License

LocalFileManager is available under the MIT license.