# How to embed resources in javascript?

**URL:** <https://discuss.kotlinlang.org/t/how-to-embed-resources-in-javascript/19638>\
**Category:** JavaScript\
**Created:** [October 24, 2020, 4:54pm UTC](https://discuss.kotlinlang.org/t/how-to-embed-resources-in-javascript/19638 "2020-10-24T16:54:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loke](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@Loke](https://discuss.kotlinlang.org/u/Loke)\
**Post date:** [October 24, 2020, 4:54pm UTC](https://discuss.kotlinlang.org/t/how-to-embed-resources-in-javascript/19638/1 "2020-10-24T16:54:31Z")

</div>

In my build I have a text file containing some data that is needed by my program. It’s a multiplatform project and for the JVM and Native targets I simply load the content of the file using `FileInputStream` and the Unix read/write system calls respectively.

I now want to support Javascript, and I believe the simplest way to handle this is to simply embed the content of this file in the generated Javascript. Ideally I should simply be able to read the content of a string, with everything set up at build time.

Is there a simple way to do this? Perhaps Gradle already has the necessary functionality? If not, is there some way to achieve this?
