Open timheuer opened 3 years ago
Yeah I've been debating how to handle this (license too). Never considered the base64 trick. I like it!
I did a quick hack to prove 'it works' but now need to figure out how to extract/read the image stream which really could be anywhere in the package -- so thinking PackageData would have another List
The current streaming support is through PackageData.Entry
which loads the compressed data from nuget into a MemoryStream
. The memory stream is used to get seekability, but not everything requires that so there's some room for optimization.
The entries are queried when the package data is loaded. I think I already also force nuspec loading at that point (to check the license) so it should be easy to match up the XML icon name with the entry list at that point.
Somewhere around here:
FYI while the iconUrl field in .nuspec files have been deprecated, the iconUrl field in the package metadata API is still valid: https://docs.microsoft.com/en-us/nuget/api/registration-base-url-resource#catalog-entry
Even for packages with embedded icons, nuget.org will have a valid iconUrl there. I would recommend loading icons from that URL.
With the deprecation of
iconUrl
packages have moved toicon
which is a package-local path to an icon image. Move to using this inPackageData
and extract that as base64 data URI to display