New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

line-current

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

line-current

Get current line in terminal at any time

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Line-current module

Description

You can use this module to get the current line of the terminal in a pretty short time

Installation

npm install line-current

Usage (Normal)

var linecurrent = require("line-current");

var app = async function(){
    var currentLine = await linecurrent.get();
    //Put your code here
    //

    //Printing current line to terminal
    console.log(currentLine);
    //Printing confirmation message to terminal
    console.log("It's working!");

    //Lets get it again:
    currentLine = await linecurrent.get();
    //Printing current line to terminal
    console.log(currentLine);
    //Printing confirmation message to terminal
    console.log("It's still working!");
}
app();

//If you put code here everything will fall appart
//

Will return:

{"processtime":%time it took to get current line%,"current-line":%current line%}
It's working!
{"processtime":%time it took to get current line%,"current-line":%current line%}
It's still working!

Usage (Formatted)

var linecurrent = require("line-current");

var app = async function(){
    var currentLine = await linecurrent.get(true);
    //Put your code here
    //

    //Printing current line to terminal
    console.log(currentLine);
    //Printing confirmation message to terminal
    console.log("It's working!");

    //Lets get it again:
    currentLine = await linecurrent.get(true);
    //Printing current line to terminal
    console.log(currentLine);
    //Printing confirmation message to terminal
    console.log("It's still working!");
}
app();

//If you put code here everything will fall appart
//

Will return:

{
    "processtime": %time it took to get current line%,
    "current-line": %current line%
}
It's working!
{
    "processtime": %time it took to get current line%,
    "current-line": %current line%
}
It's still working!

Syntax

await linecurrent.get(%formatted?%);

Output exemple (normal)

{"current-line":1,"processtime":"143ms"}

Output exemple (formatted)

{
    "current-line": 1,
    "processtime": "143ms"
}

Details

Output are json as string, you can parse it with JSON.parse() if you want to use it as an object, to run the get command you need to use it with await in a async function in the exemples it was app else everything will fall appart.

How does it work

This module uses the ainsi escape code on the current line process the output revert the terminal to before that and returns the output as formatted or not depending on function args.

Creator

It's me willmil11 :)

Keywords

Line

FAQs

Package last updated on 04 Sep 2023

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