diff options
Diffstat (limited to 'src/bun.js/webcore/blob.zig')
-rw-r--r-- | src/bun.js/webcore/blob.zig | 19 |
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, |