Socket
Socket
Sign inDemoInstall

listen-in

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

listen-in

Promise based STDIN listener for node applications


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

listen-in

Travis npm npm

listen-in is a simple to use, Promise based, STDIN listener for node applications

Motivation

listen-in was written because I wanted a way to pass secure information into Node applications with out adding EXPORT or configuration files to my user profile.

Basic Use

const lstn = require('listen-in');

lstn({
  message: 'First Name: ',
  insecure: true
})
.then(data => {
  console.log(`First Name: ${data}`);
});

Use with es2017 Async/Await

import lstn from 'listen-in';

const config = async () => ({
  dbName: 'production',
  dbUser: 'username',
  dbPassword: await listn({ insecure: true, message: 'Database Password: ' })
});

Use for updating process.env:

import lstn from 'listen-in';

function getConfigs() {
  return lstn({ message: 'Database Password: ', envToken: 'dbp'})
  .then(() => ({
    dbName: 'production',
    dbUser: 'username',
    dbPassword: process.env.dbp
  }));
}

Options

  • envToken [String]: add value to process.env under this name. (default null)
  • message [String]: Message to prompt user with. (default null)
  • insecure [Boolean]: Passes user input into the then.

Keywords

FAQs

Package last updated on 21 Sep 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc