kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

Support a way to embed resources into code and use as a streams

Open antanas-arvasevicius opened this issue 7 years ago • 1 comments

Hi, We are struggling to find a way how to include some html templates in our multiplatform project (JVM, iOS, JS) and it looks like there is no way how to do this. I'd remembered from Flash Player that there was something called Assets Embedding, which uses annotation:

        [Embed(source="sound1.mp3")] 
        public var soundCls:Class; 

Maybe kotlinx.io could have some annotation:

@Embed(resource="...")
val bytes:BufferedInputStream;

which automatically embeds resource files into application during compilation. Now it's hard to include some small binary files into project as now we need to bundle files into packages for each platform and deploy separately executables + assets and implement some ResourcesManager for each platform manually.

antanas-arvasevicius avatar Oct 10 '18 14:10 antanas-arvasevicius

Maybe you can try kotlinx.html with DSLMarker.

Mark resources as annotation, embed resource files into klib, which just like jar file's structures.

9468305 avatar May 26 '19 10:05 9468305

We're rebooting the kotlinx-io development (see https://github.com/Kotlin/kotlinx-io/issues/131), all issues related to the previous versions will be closed. Consider reopening it if the issue remains (or the feature is still missing) in a new version.

fzhinkin avatar Jun 12 '23 11:06 fzhinkin