
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
readline-browser
Advanced tools
This library is designed with same APIs as the node.js core module `readline`.
This library is designed with same APIs as the node.js core module readline.
Which supports you start a repl in a browser environment.
xterm.jsconst { Terminal } = require("xterm");
const rl = require("readline-browser");
const getStringWidth = require("string-width");
const term = new Terminal();
term.open(document.getElementById("terminal"));
function getMappedKeyName(rawName){
if(rawName == "Backspace"){
return "backspace";
}else if(rawName == "ArrowLeft"){
return 'left';
}else if(rawName == "ArrowRight"){
return 'right';
}else if(rawName == "ArrowUp"){
return 'up';
}else if(rawName == "ArrowDown"){
return 'down';
}else if(rawName == "Delete"){
return 'delete';
}else if(rawName == "Enter"){
return 'enter';
}else if(rawName == "Tab"){
return 'tab';
}else if(rawName == "Home"){
return 'home';
}else if(rawName == "End"){
return 'end';
}else if(rawName == "Return"){
return 'return';
}
return rawName;
}
const input = {
on(event,listener){
if(event == "data"){
}else if(event == "keypress"){
term.onData((char)=>{
if(getStringWidth(char)>=2){
listener(char,{
sequence:char,
name:undefined,
ctrl:false,
meta:false,
shift:false,
})
}
});
term.onKey(({key,domEvent})=>{
const name = getMappedKeyName(domEvent.key);
const ctrl = domEvent.ctrlKey;
const shift = domEvent.shiftKey;
listener(key,{
sequence:name,
name,
ctrl,
shift
});
});
}
},
resume(){
console.log("resume");
},
pause(){
console.log("pause");
}
}
const output = {
isTTY:true,
get columns(){
return term.cols;
},
on(event,listener){
if(event == "resize"){
term.onResize(listener);
}
},
write(data){
term.write(data);
}
}
const intf = rl.createInterface(input,output);
async function startRepl(){
while(true){
console.log(await new Promise((resolve)=>intf.question("$ > ",resolve)));
}
}
startRepl();
//const rl = require("readline");
const rl = require("readline-browser");
//some other things
FAQs
This library is designed with same APIs as the node.js core module `readline`.
We found that readline-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.