-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable prepareAttachment for cpp as well as js
- Loading branch information
1 parent
27f6c56
commit 3837fb9
Showing
3 changed files
with
34 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
} |
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,8 @@ | ||
package snikket; | ||
|
||
@:forward | ||
abstract AttachmentSource(js.html.File) { | ||
public inline function tinkSource() { | ||
return tink.io.Source.ofJsFile(this.name, this); | ||
} | ||
} |
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