How to use nodejs 'fs' or 'http' modules inside GraalVM polyglot applications

Viewed 96

I would like to wrap an npm package with GraalVM, for using it inside the jvm but acording to documentation, GraalVM can not load scripts (as part of polyglot js applications) that make use of native nodejs modules like 'fs' and 'http':

When embedded in a Java application (using the Context API), GraalVM JavaScript can execute JavaScript applications and modules that do not depend on Node.js’ built-in modules such as 'fs', 'events', or 'http' or Node.js-specific functions such as setTimeout() or setInterval().

https://www.graalvm.org/22.0/reference-manual/js/Modules/#java-based-applications-context-api

Is there any workaround to provide (full or partial) 'fs' and 'http' implementations for js scripts to run on GraalVM polyglot Context?

0 Answers
Related