Scaffold v1.0.0

This commit is contained in:
T. R. Bernstein
2026-04-17 01:08:29 +02:00
commit 292a2c859b
22 changed files with 983 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import Foundation
struct FileContentReader {
func readTextContent(of file: EmbeddableFile) throws -> String {
do {
return try String(contentsOf: file.absoluteURL, encoding: .utf8)
} catch {
throw FileContentReaderError.couldNotDecodeAsUTF8(
path: file.absoluteURL.path,
underlying: error
)
}
}
}
enum FileContentReaderError: Error, CustomStringConvertible {
case couldNotDecodeAsUTF8(path: String, underlying: Error)
var description: String {
switch self {
case .couldNotDecodeAsUTF8(let path, let underlying):
return "failed to read \(path) as UTF-8: \(underlying.localizedDescription)"
}
}
}