mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-06-08 19:26:48 +00:00
Updated nodejs contract lib for streamed input reading. (#110)
This commit is contained in:
@@ -12,19 +12,16 @@ if (!hpc.readonly)
|
||||
Object.keys(hpc.users).forEach(function (key) {
|
||||
|
||||
const user = hpc.users[key];
|
||||
const inputBuf = user.readInput();
|
||||
if (inputBuf) {
|
||||
const userInput = inputBuf.toString("utf8");
|
||||
user.readInput().then(inputBuf => {
|
||||
if (inputBuf) {
|
||||
const userInput = inputBuf.toString("utf8");
|
||||
|
||||
// Append user input to a state file if not in read only mode.
|
||||
if (!hpc.readonly)
|
||||
fs.appendFileSync("userinputs.txt", userInput + "\n");
|
||||
|
||||
if (userInput == "ts")
|
||||
user.sendOutput(fs.readFileSync("exects.txt"));
|
||||
else
|
||||
user.sendOutput("Echoing: " + userInput);
|
||||
}
|
||||
if (userInput == "ts")
|
||||
user.sendOutput(fs.readFileSync("exects.txt"));
|
||||
else
|
||||
user.sendOutput("Echoing: " + userInput);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//console.log("===Echo contract ended===");
|
||||
|
||||
Reference in New Issue
Block a user