From e4bf2901de0c5a55547f433e368244139faebe66 Mon Sep 17 00:00:00 2001 From: Bergi9 Date: Tue, 5 Sep 2017 18:51:14 +0200 Subject: [PATCH] Add argument for temp directory at creating nodeJS --- .../java/com/eclipsesource/v8/NodeJS.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eclipsesource/v8/NodeJS.java b/src/main/java/com/eclipsesource/v8/NodeJS.java index 46552122f..95914a811 100644 --- a/src/main/java/com/eclipsesource/v8/NodeJS.java +++ b/src/main/java/com/eclipsesource/v8/NodeJS.java @@ -45,7 +45,20 @@ public class NodeJS { * been compiled for your platform. */ public static NodeJS createNodeJS() { - return createNodeJS(null); + return createNodeJS(null, null); + } + + /** + * Creates a NodeJS runtime and executes a JS Script + * + * @param file The JavaScript to execute or null for no script. + * @return The NodeJS runtime. + * + * May throw an UnsupportedOperationException if node.js integration has not + * been compiled for your platform. + */ + public static NodeJS createNodeJS(final File file){ + return createNodeJS(file, null); } /** @@ -75,13 +88,14 @@ public String getNodeVersion() { * Creates a NodeJS runtime and executes a JS Script * * @param file The JavaScript to execute or null for no script. + * @param tempDirectory The name of the directory to extract the native * @return The NodeJS runtime. * * May throw an UnsupportedOperationException if node.js integration has not * been compiled for your platform. */ - public static NodeJS createNodeJS(final File file) { - V8 v8 = V8.createV8Runtime(GLOBAL); + public static NodeJS createNodeJS(final File file, final String tempDirectory) { + V8 v8 = V8.createV8Runtime(GLOBAL, tempDirectory); final NodeJS node = new NodeJS(v8); v8.registerJavaMethod(new JavaVoidCallback() {