# Read glb file from string

**URL:** <https://forum.babylonjs.com/t/read-glb-file-from-string/22224>\
**Category:** Questions\
**Created:** [July 7, 2021, 4:39pm UTC](https://forum.babylonjs.com/t/read-glb-file-from-string/22224 "2021-07-07T16:39:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcusx2](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marcusx2/32/17238_2.png) [@marcusx2](https://forum.babylonjs.com/u/marcusx2)\
**Post date:** [July 7, 2021, 4:39pm UTC](https://forum.babylonjs.com/t/read-glb-file-from-string/22224/1 "2021-07-07T16:39:36Z")

</div>

Pretty much like [this example](https://playground.babylonjs.com/#88CB6A), but I want to read a .glb file, not a .gltf file, because it’s a model with textures and materials. Is there a way to have a .glb string and have babylonjs instantiate a model from it? Or is there a way to use a normal .gltf but with the external textures and materials embedded in the string as well?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 7, 2021, 5:31pm UTC](https://forum.babylonjs.com/t/read-glb-file-from-string/22224/2 "2021-07-07T17:31:33Z")

</div>

You could use base64 for glb

> **[Loading Any File Type | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/importers/loadingFileTypes#direct-loading-base64-encoded-models)**
>
> Learn how to import any file type in Babylon.js.

[https://playground.babylonjs.com/#58T0JY](https://playground.babylonjs.com/#58T0JY)

---

<div class="post-metadata">

**Author:** ![Vu\_Dang\_Nguyen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vu_dang_nguyen/32/16055_2.png) [@Vu\_Dang\_Nguyen](https://forum.babylonjs.com/u/Vu_Dang_Nguyen)\
**Post date:** [August 9, 2021, 3:22am UTC](https://forum.babylonjs.com/t/read-glb-file-from-string/22224/3 "2021-08-09T03:22:58Z")

</div>

I have a Question:  
Can I copy base64 string to txt file or html file and read it from “data:base64,/string.txt”?  
Thank very much

---

<div class="post-metadata">

**Author:** ![Vinc3r](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinc3r/32/25340_2.png) [@Vinc3r](https://forum.babylonjs.com/u/Vinc3r)\
**Post date:** [August 9, 2021, 9:28am UTC](https://forum.babylonjs.com/t/read-glb-file-from-string/22224/4 "2021-08-09T09:28:58Z")

</div>

You just have to load the file like in this example (using json): [How to read an external local JSON file in JavaScript? - Stack Overflow](https://stackoverflow.com/a/34579496)

---

<div class="post-metadata">

**Author:** ![DarraghBurke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/darraghburke/32/10621_2.png) [@DarraghBurke](https://forum.babylonjs.com/u/DarraghBurke)\
**Post date:** [August 9, 2021, 9:44pm UTC](https://forum.babylonjs.com/t/read-glb-file-from-string/22224/5 "2021-08-09T21:44:52Z")

</div>

Not sure why you would use a data URL if the data you are loading is already in a file, in that case you can probably just load the file directly. Can you explain what you’re trying to do a bit more?
