Skip to content

Commit

Permalink
Enhance saveToTempFile method to accept file extension parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
phisakel committed Nov 21, 2024
1 parent 1bc777c commit feb3335
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/RqesKit/RQESService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public class RQESService: RQESServiceProtocol, @unchecked Sendable {
return try await rqes.calculateHash(request: request, accessToken: accessToken)
}

static func saveToTempFile(data: Data) throws -> URL {
static func saveToTempFile(data: Data, ext: String = ".pdf") throws -> URL {
let tempDir = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
let tempFile = tempDir.appendingPathComponent(UUID().uuidString)
let tempFile = tempDir.appendingPathComponent("\(UUID().uuidString)\(ext)")
try data.write(to: tempFile)
return tempFile
}
Expand Down

0 comments on commit feb3335

Please sign in to comment.