Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

repli

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

repli

Minimalist REPL client for node

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

repli

Minimalist REPL client for node

Installation

npm install -g repli

Usage

  1. Create a repl server somewhere in you application (see exemples/server.js):
'use strict'
const repl = require('repl')
const net = require('net')

net.createServer((socket) => {
  socket.write('Welcome\n')

  let replServer = repl.start({
    prompt: '> ',
    input: socket,
    output: socket,
    terminal: true,
    useGlobal: false
  })

  replServer.on('exit', () => socket.end())

  replServer.context.actions = {
    sayHello (who) {
      console.log('Hello %s !', who || 'World')
      socket.write('(Done)\n')
    }
  }

}).listen(4242)
  1. Then use repli to use it:
repli localhost 4242
> Connect to ip:127.0.0.1 (IPv4)
Welcome
> action.sayHello('Foobar')
(Done)
undefined
> _

Credit

Based on TooTallNate gist


The MIT License

Keywords

FAQs

Package last updated on 16 Mar 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc