Create MediaItem from b64 string

Hi,

I would like to know if there is a way from a TS function to create a MediaItem from a B64 string and subsequently assign it to a mediaReference/ MediaSet?

Thanks

Hello!

It’s not currently possible to create a MediaItem from a base64 string within a typescript function. Would you be able to elaborate on what your use case / workflow is, so we can help find an alternative solution or understand why this is needed?

Thanks,
Isy

Hello,

Thanks for the answer.

We are creating pdf via a python function, and we get a b64 string of the pdf.
We would like to assign it to an object via a mediaReference property/ mediaset so that this could be used downstream.

Alternatively, we can save that as a b64 string on the object but that means that it will be more expensive every time we load the object.

Could you just write the generated PDF directly into a MediaSet and then use MediaReferences on the objects? What’s the reasoning behind also generating a b64 string for use?

i am probably missing something but how do you generate PDF directly into a MediaSet from a FoO?

This would definitely work but I just do not know how to generate the PDF directly in the MediaSet from a FoO. Do you have an example?