cursor-pos
A bash-based package to get the current position in the terminal.
Will only work on systems that have bash.
Installation
Install with npm:
npm install cursor-pos
Usage
const getCursorPosition = require('./cursor-pos');
async function main() {
let pos = await getCursorPosition();
console.log('pos: ', pos);
}
main();
Output:
pos: { row: 13, column: 0 }
Credit
Inspired by cursor.js from here.