From 337bfac5e328621085001232a5495d49b79a2000 Mon Sep 17 00:00:00 2001 From: Marcel Kottmann Date: Sat, 15 May 2021 15:34:00 +0200 Subject: [PATCH] update repl example --- examples/repl.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/repl.js b/examples/repl.js index 47027d1..7dc29cf 100644 --- a/examples/repl.js +++ b/examples/repl.js @@ -1,21 +1,22 @@ /** - * + * * A network based REPL (Read–eval–print loop). - * + * * Usage: * netcat [IP-ADDRESS] 1234 - * + * * After successful connection a prompt appears: '>' * Then type [USER]:[PASS] (the defaults are esp32:esp32) * After successful authentication you will see "====> authorized." - * - * After that you can type every JS expression, which then gets - * evaluated in esp32-javascript and the result is printed. - * + * + * After that you can type every JS expression, which then gets + * evaluated in esp32-javascript and the result is printed. + * */ var configManager = require("esp32-javascript/config"); var PROMPT = "> "; +var textDecoder = new TextDecoder(); function writeOutput(socket, result) { socket.write(result); @@ -27,7 +28,8 @@ require("socket-events").sockListen( function (socket) { var authorized = false; var _ = undefined; - socket.onData = function (data) { + socket.onData = function (buffer) { + var data = textDecoder.decode(buffer); var result = null; if (!authorized) { var accessConfig = configManager.config.access; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy