-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from awaescher/merge
Merge improved image handling
- Loading branch information
Showing
9 changed files
with
267 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OllamaSharp; | ||
|
||
/// <summary> | ||
/// Extensions for byte arrays | ||
/// </summary> | ||
public static class ByteArrayExtensions | ||
{ | ||
/// <summary> | ||
/// Converts a series of bytes to a base64 string | ||
/// </summary> | ||
/// <param name="bytes">The bytes to convert to base64</param> | ||
public static string ToBase64(this IEnumerable<byte>? bytes) => Convert.ToBase64String(bytes.ToArray()); | ||
|
||
/// <summary> | ||
/// Converts multiple series of bytes to multiple base64 strings, one for each. | ||
/// </summary> | ||
/// <param name="byteArrays">The series of bytes to convert to base64</param> | ||
public static IEnumerable<string>? ToBase64(this IEnumerable<IEnumerable<byte>>? byteArrays) => byteArrays?.Select(ToBase64); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.