git » sdk » main » tree

[main] / borogove / AttachmentSource.cpp.hx

package borogove;

#if cpp
import HaxeCBridge;
#end

@:expose
#if cpp
@:build(HaxeCBridge.expose())
@:build(HaxeSwiftBridge.expose())
#end
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;
	}

	@:allow(borogove)
	private inline function tinkSource() {
		return tink.io.Source.ofInput(this.name, sys.io.File.read(path));
	}
}