Files
fil/docs/snippets/swift/api/extract_bytes_async.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

549 B

import Foundation
import Kreuzberg
import RustBridge

@main
struct App {
    static func main() async throws {
        let data = try Data(contentsOf: URL(fileURLWithPath: "document.pdf"))
        let content = RustVec<UInt8>()
        for byte in data { content.push(value: byte) }

        let config = try extractionConfigFromJson("{}")
        let result = try await extractBytes(content, "application/pdf", config)

        print(result.content().toString())
        print("Tables: \(result.tables().count)")
    }
}