We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We use SuperJSON so you can use types beyond regular JSON in your payloads/outputs. It would be great to add Blob to this.
The source code is here:
trigger.dev/packages/core/src/v3/utils/ioSerialization.ts
Line 419 in f7bf7bc
TRI-4135
The text was updated successfully, but these errors were encountered:
@matt-aitken here's what I tried for adding Blob to SuperJSON
superjson.registerCustom<Blob, number[]>( { isApplicable: (v): v is Blob => typeof Blob === "function" && v instanceof Blob, serialize: async (v) => { const arrayBuffer = await v.arrayBuffer(); return [...(new Uint8Array(arrayBuffer))]; }, deserialize: (v) => { const u8Array = new Uint8Array(v); const arrayBuffer = u8Array.buffer.slice(u8Array.byteOffset, u8Array.byteOffset + u8Array.byteLength); return new Blob([arrayBuffer]); }, }, "blob" );
but unfortunately serialize function cannot return promise and Blob cannot be serialized synchronously. Would you consider other approach for this?
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
We use SuperJSON so you can use types beyond regular JSON in your payloads/outputs. It would be great to add Blob to this.
The source code is here:
trigger.dev/packages/core/src/v3/utils/ioSerialization.ts
Line 419 in f7bf7bc
TRI-4135
The text was updated successfully, but these errors were encountered: