2958a26e4f
Replaces specialized binary and HTML downloaders with a generic, options-driven UnitDownloader and UnitFragmentDownloader pattern. Introduces UnitDownloaderOptions and builder classes for flexible configuration, updates interfaces and method signatures to support progress reporting, and removes redundant binary-specific classes. Updates Playwright and Stealth downloaders to use the new generic base, and adds improved error handling and reporting. Also updates dependency versions and makes minor API consistency improvements across the Fluent and Models layers.
25 lines
697 B
C#
25 lines
697 B
C#
using System.Text;
|
|
|
|
namespace Beam.Models {
|
|
public class ByteDocument : Document {
|
|
public ByteDocument(string filename, byte[] content, Encoding? encoding = null) : base(filename, encoding) {
|
|
Content = content;
|
|
}
|
|
|
|
public ByteDocument(string filename, Memory<byte> content, Encoding? encoding = null) :
|
|
base(filename, encoding) {
|
|
Content = content;
|
|
}
|
|
|
|
public Memory<byte> Content { get; set; }
|
|
|
|
public override byte[] ToBytes() {
|
|
return Content.ToArray();
|
|
}
|
|
|
|
public override string ToString() {
|
|
return Encoding.GetString(Content.ToArray());
|
|
}
|
|
}
|
|
}
|