Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 1 KB

README.md

File metadata and controls

28 lines (23 loc) · 1 KB

Lang mit Tests

FileStreamer

Continuous data to disk

Installation:

  • SPM "https://github.com/light-stream/FileStreamer.git" branch: "master"

Writer example:

let filePath: String = NSString(string: "~/Desktop/del.txt").expandingTildeInPath
guard let data: Data = ("black dog" as NSString).data(using: String.Encoding.utf8.rawValue) else {Swift.print("unable to create data");return}
FSWriter.write(url: URL(filePath), data: data, index: 0)

Reader example:

let filePath: String = NSString(string: "~/Desktop/del.txt").expandingTildeInPath
let data: Data = FSReader.read(filePath: filePath, startIndex: 50, endIndex: 100)
Swift.print("\(String(data: data, encoding: .utf8))") // blalbslalballabalbla...

Size example:

let fileSize = FSReader.fileSize(filePath: filePath)