at main 630 B view raw
1// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers 2// 3// SPDX-License-Identifier: MPL-2.0 4 5import Foundation 6import llbuild2fx 7 8extension Keys.Blob { 9 public struct ReadContents: BuildKey { 10 let blobId: LLBDataID 11 12 public init(blobId: LLBDataID) { 13 self.blobId = blobId 14 } 15 16 public typealias ValueType = String 17 18 public static let versionDependencies: [any FXVersioning.Type] = [] 19 20 public func computeValue(_ ctx: BuildContext<Self>) async throws -> String { 21 let contents = try await ctx.load(blobId) 22 return try await String(decoding: Data(ctx.read(blob: contents.blob!)), as: UTF8.self) 23 } 24 } 25}