Looking for a way to edit a GLB file as a string in runtime

I would suggest setting aside GLB for a moment — generate a Uint8Array with some simple string content…

const binary = new TextEncoder().encode('hello world');

… and try to use whatever libraries or APIs are needed to encrypt that on the server and decrypt it on the client. once you have something that correctly decrypts the binary data, you’ll be able to do this and get the same string back:

const text = new TextDecoder().decode(binary);

From there, exactly the same method will work fine for a binary file containing GLB data.

1 Like