Trouble saving b3dm content to file

I am querying the Cesium Ion REST API and getting back the tileset.json. Once I have that back I end up querying the API again to get a particular .b3dm asset and am attempting to save it to disk. My goal is to convert that .b3dm file to .glb and display it in my custom app using Vulkan Scene Graph.

I have currently done this type of conversion and displayed assets correctly using the 3D samples here (GitHub - CesiumGS/3d-tiles-samples: Sample tilesets for learning how to use 3D Tiles).

However, when I save the API response to a file, the .glb conversion seems to be successful but ultimately cannot be opened. I think the problem is my saving the .b3dm from the REST API.

I currently am using libcurl to make the request, and have added the headers for the access token, as well as the gzip encoding. The request is successful in the application as well as using Insomnia (test app for web requests), so I know the request isn’t really an issue unless I am missing some elusive crucial header type. Does anyone have any suggestions on how I can save the .b3dm response to a file?

Thanks!

To elaborate, I actually have no problem saving the b3dm file. The issue is actually saving a .glb from the .b3dm includes Draco decompression metadata.

I am looking to save the decompressed image as a .glb instead of including the Draco metadata in the binary. If anyone has experience with that please let me know. I am planning on using a combination of tiny_gltf and Draco libraries to help with this processing.

First a short hint: You may not have to go all the way through curl to obtain the B3DM files: The Archives and Exports feature allows you to conveniently download your assets as a ZIP file. (If you are obtaining B3DM files from assets that are not yours, then this might be a first step of “scraping” data from Cesium ion, which would be against the Terms of Service. So you should only obtain B3DMs from your assets).

To elaborate, I actually have no problem saving the b3dm file. The issue is actually saving a .glb from the .b3dm includes Draco decompression metadata.

The role of Draco, or what remains from the question after downloading the B3DM files already works, is not entirely clear. When you want to extract the GLB data from a B3DM, you could use the 3d-tiles-tools for that. If you want to remove the Draco compression from a GLB, then this should be possible with dedicated glTF libraries or web applications (like https://gltf-transform.donmccurdy.com/ or https://gltf.report/ ). Or was the goal something else here?