LoginSignup
2
2

More than 5 years have passed since last update.

NodeJSでターミナルサイズの取得

Posted at

サイズを取得したいと思ったので。
term-sizeというパッケージを使うと楽に取得できます。これはmacやlinuxだけじゃなくwinにも対応してます。

インストール

npm5
npm i term-size
yarn
yarn add term-size

使う

const termSize = require('term-size');
// import termSize from 'tarm-size';
console.log(termSize());
$ node index.js                                                                                                                                                                         
{ columns: 212, rows: 27 }
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2