aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.mjs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-10-02 01:27:55 +0900
committernsfisis <nsfisis@gmail.com>2023-10-02 01:27:55 +0900
commit7e9c65507f2ba51ff7c13cfc18cf29722b89c973 (patch)
treead4a566a5bf9e225b212c033608188b31735d6fb /index.mjs
parentfcf36b3c9e42ab9fa0ed0e037c6492d0d496f954 (diff)
downloadtiny-php.wasm-7e9c65507f2ba51ff7c13cfc18cf29722b89c973.tar.gz
tiny-php.wasm-7e9c65507f2ba51ff7c13cfc18cf29722b89c973.tar.zst
tiny-php.wasm-7e9c65507f2ba51ff7c13cfc18cf29722b89c973.zip
commit files
Diffstat (limited to 'index.mjs')
-rw-r--r--index.mjs12
1 files changed, 12 insertions, 0 deletions
diff --git a/index.mjs b/index.mjs
new file mode 100644
index 0000000..f58aa15
--- /dev/null
+++ b/index.mjs
@@ -0,0 +1,12 @@
+import { readFile } from 'node:fs/promises';
+import PHPWasm from './php-wasm.mjs'
+
+const code = await readFile('/dev/stdin', { encoding: 'utf-8' });
+
+const { ccall } = await PHPWasm();
+const result = ccall(
+ 'php_wasm_run',
+ 'number', ['string'],
+ [code],
+);
+console.log(`result: ${result}`);