API reference › @evolu/common › Object › ObjectURL
Defined in: packages/common/src/Object.ts:236
A disposable wrapper around URL.createObjectURL that automatically revokes
the URL when disposed. Use with the using declaration for automatic
cleanup.
Example
const blob = new Blob(["hello"], { type: "text/plain" });
using objectUrl = createObjectURL(blob);
console.log(objectUrl.url); // blob:...
// URL.revokeObjectURL is automatically called when the scope ends
This ensures the URL is always revoked when the scope ends, even if an error occurs, preventing memory leaks from unreleased blob URLs.
Extends
Methods
[dispose]()
dispose: void;
Defined in: node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts:36
Inherited from
Disposable.[dispose]
Properties
url
readonly url: string;
Defined in: packages/common/src/Object.ts:238
The object URL string created by URL.createObjectURL.