aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/webcore/blob.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-09 21:44:05 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-09 21:44:05 -0700
commitc7c5dc14384f81a2d245870d2848c0512193690d (patch)
tree92da71a371cff795f0fd1b886fece062879af372 /src/bun.js/webcore/blob.zig
parenta5b3056c76268e4bf219f68a15827be5b564313b (diff)
downloadbun-c7c5dc14384f81a2d245870d2848c0512193690d.tar.gz
bun-c7c5dc14384f81a2d245870d2848c0512193690d.tar.zst
bun-c7c5dc14384f81a2d245870d2848c0512193690d.zip
Add `name` property
Diffstat (limited to 'src/bun.js/webcore/blob.zig')
-rw-r--r--src/bun.js/webcore/blob.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/bun.js/webcore/blob.zig b/src/bun.js/webcore/blob.zig
index f0692d482..4005a6bcc 100644
--- a/src/bun.js/webcore/blob.zig
+++ b/src/bun.js/webcore/blob.zig
@@ -2544,6 +2544,25 @@ pub const Blob = struct {
return ZigString.Empty.toValue(globalThis);
}
+ // TODO: Move this to a separate `File` object or BunFile
+ pub fn getName(
+ this: *Blob,
+ globalThis: *JSC.JSGlobalObject,
+ ) callconv(.C) JSValue {
+ if (this.store) |store| {
+ if (store.data == .file) {
+ if (store.data.file.pathlike == .path) {
+ return ZigString.fromUTF8(store.data.file.pathlike.path.slice()).toValueGC(globalThis);
+ }
+
+ // we shouldn't return Number here.
+ }
+ }
+
+ return JSC.JSValue.jsUndefined();
+ }
+
+ // TODO: Move this to a separate `File` object or BunFile
pub fn getLastModified(
this: *Blob,
_: *JSC.JSGlobalObject,