| author | Matthew Wild
<mwild1@gmail.com> 2025-04-15 14:54:25 UTC |
| committer | Matthew Wild
<mwild1@gmail.com> 2025-04-15 16:14:45 UTC |
| parent | 70d170f39f4271568fe595d836d7cfcfac6f497f |
| snikket/AttachmentSource.hx | +19 | -0 |
diff --git a/snikket/AttachmentSource.hx b/snikket/AttachmentSource.hx index e69de29..d0da87a 100644 --- a/snikket/AttachmentSource.hx +++ b/snikket/AttachmentSource.hx @@ -0,0 +1,19 @@ +package snikket; + +class AttachmentSource { + public final path: String; + public final type: String; + public final name: String; + public final size: Int; + + public function new(path: String, mime: String) { + this.name = haxe.io.Path.withoutDirectory(path); + this.path = sys.FileSystem.fullPath(path); + this.size = sys.FileSystem.stat(this.path).size; + this.type = mime; + } + + public inline function tinkSource() { + return tink.io.Source.ofInput(this.name, sys.io.File.read(path)); + } +}