Files
anki-static/AnkiStatic.Test/Utils.fs
patrick 3e3d092c27
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
Add JSON input (#3)
Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk>
Reviewed-on: #3
2023-09-08 18:19:06 +00:00

22 lines
535 B
Forth

namespace AnkiStatic.Test
open System
open System.IO
open System.Reflection
[<RequireQualifiedAccess>]
module Utils =
let readResource (assembly : Assembly) (name : string) : string =
let names =
assembly.GetManifestResourceNames ()
|> Seq.filter (fun s -> s.EndsWith (name, StringComparison.Ordinal))
use stream =
names
|> Seq.exactlyOne
|> assembly.GetManifestResourceStream
|> fun s -> new StreamReader (s)
stream.ReadToEnd ()