1 module libwasm.bindings.Blob;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 @safe:
7 nothrow:
8 
9 struct Blob {
10   nothrow:
11   JsHandle handle;
12   alias handle this;
13   this(Handle h) {
14     this.handle = JsHandle(h);
15   }
16   uint size()() {
17     return Object_Getter__uint(this.handle, "size");
18   }
19   string type()() {
20     return Object_Getter__string(this.handle, "type");
21   }
22   auto slice()(int start, int end, string contentType) {
23     return Blob(Serialize_Object_VarArgCall!Handle(this.handle, "slice", "int;int;string", tuple(start, end, contentType)));
24   }
25   auto slice()(int start, int end) {
26     return Blob(Serialize_Object_VarArgCall!Handle(this.handle, "slice", "int;int", tuple(start, end)));
27   }
28   auto slice()(int start) {
29     return Blob(Object_Call_int__Handle(this.handle, "slice", start));
30   }
31   auto slice()() {
32     return Blob(Object_Getter__Handle(this.handle, "slice"));
33   }
34   string blobImplType()() {
35     return Object_Getter__string(this.handle, "blobImplType");
36   }
37 }
38 alias BlobPart = SumType!(BufferSource, Blob, string);
39 struct BlobPropertyBag {
40   nothrow:
41   JsHandle handle;
42   alias handle this;
43   this(Handle h) {
44     this.handle = JsHandle(h);
45   }
46   static auto create() {
47     return BlobPropertyBag(libwasm_add__object());
48   }
49   void type()(string type) {
50     Object_Call_string__void(this.handle, "type", type);
51   }
52   string type()() {
53     return Object_Getter__string(this.handle, "type");
54   }
55   void endings()(EndingTypes endings) {
56     Object_Call_int__void(this.handle, "endings", endings);
57   }
58   EndingTypes endings()() {
59     return Object_Getter__int(this.handle, "endings");
60   }
61 }
62 enum EndingTypes {
63   transparent,
64   native
65 }
66 
67