{"name":"window-size","description":"Reliable way to to get the height and width of the terminal/console in a node.js environment.","version":"0.3.0","homepage":"https://github.com/jonschlinkert/window-size","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"contributors":[{"name":"Benjamin E. Coe","email":"ben@npmjs.com","url":"https://twitter.com/benjamincoe"},{"name":"Carlos Hernández Gómez","url":"https://github.com/karliky"},{"name":"Jon Schlinkert","email":"jon.schlinkert@sellside.com","url":"http://twitter.com/jonschlinkert"},{"name":"Siddharth Kannan","email":"kannan.siddharth12@gmail.com","url":"http://www.icyflame.me"}],"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/window-size.git"},"bugs":{"url":"https://github.com/jonschlinkert/window-size/issues"},"license":"MIT","files":["cli.js","index.js"],"main":"index.js","bin":{"window-size":"cli.js"},"engines":{"node":">= 0.10.0"},"scripts":{"test":"tap --coverage test.js"},"devDependencies":{"gulp-format-md":"^0.1.11","semistandard":"^9.2.1","tap":"^8.0.1"},"keywords":["console","height","resize","size","terminal","tty","width","window"],"verb":{"related":{"list":["base-cli","lint-deps","yargs"]},"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb","verb-generate-readme"]},"gitHead":"4e43a7002ec4d0a1540ea2716fd404b105080938","_id":"window-size@0.3.0","_shasum":"b8f0b66e325d22160751e496337e44b45b727546","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"},{"name":"doowb","email":"brian.woodward@gmail.com"}],"dist":{"shasum":"b8f0b66e325d22160751e496337e44b45b727546","tarball":"http://registry-npm.ywwl.com/window-size/download/window-size-0.3.0.tgz","integrity":"sha512-aB2BGVMsX1iPJ79hqC5JvbDvUXpy3nhoxmbiFw74aEewrHPnkNiFYAFbx+BgurhxuOUZV+qIj/9HurtO8ZTH5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9YOLP6E4miFHZUriERZiCY5QsfjEiz86NyVcJRp5NawIhAL024Vv4owVg+InoaEIteC5UuyHoDr5wP8ghLJY3xEw7"}],"size":3298,"noattachment":false,"key":"/window-size/-/window-size-0.3.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/window-size-0.3.0.tgz_1481394068971_0.060673162806779146"},"directories":{},"readme":"# window-size [![NPM version](https://img.shields.io/npm/v/window-size.svg?style=flat)](https://www.npmjs.com/package/window-size) [![NPM monthly downloads](https://img.shields.io/npm/dm/window-size.svg?style=flat)](https://npmjs.org/package/window-size)  [![NPM total downloads](https://img.shields.io/npm/dt/window-size.svg?style=flat)](https://npmjs.org/package/window-size) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/window-size.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/window-size) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/window-size.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/window-size)\n\n> Reliable way to get the height and width of terminal/console, since it's not calculated or updated the same way on all platforms, environments and node.js versions.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save window-size\n```\n\n## Usage\n\n```js\nvar size = require('window-size');\n```\n\n## CLI\n\n```sh\n$ window-size\n# height: 40\n# width : 145\n```\n\n## API\n\n### windowSize\n\nThe main export is either an object with `width` and `height` properties, or `undefined` if unable to get width and height.\n\n```js\nvar size = require('window-size');\nconsole.log(size); \n//=> {width: 80, height: 25}\n```\n\n### .get\n\nCalls the main function to get the up-to-date window size.\n\n```js\nconsole.log(size.get());\n//=> {width: 80, height: 25}\n```\n\n**Example**\n\nSee [example.js](example.js) for the code used in the below gif.\n\n```js\nprocess.stdout.on('resize', function() {\n  console.log(size.get());\n});\n```\n\n![resize event example](https://github.com/jonschlinkert/window-size/blob/master/resize.gif)\n\n**HEADS UP!**\n\nNote that some platforms only provide the initial terminal size, not the actual size after it has been resized by the user.\n\n### .env\n\nGet `process.env.COLUMNS` and `process.env.ROWS`, if defined. Called by the main function if for some reason size was not available from `process.stdout` and `process.stderr`.\n\n```js\nconsole.log(size.env());\n```\n\n### .tty\n\nAttempts to get the size from `tty`. Called by the main function if for some reason size was not available from `process.stdout`, `process.stderr` or `process.env`.\n\n```js\nconsole.log(size.tty());\n```\n\n### .win\n\nGet the terminal size in Windows 10+.\n\n```js\nconsole.log(size.win());\n```\n\nNote that this method calls [execSync](https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options) to get the size, and must be called directly, as it **is not** called by the main function.\n\n### .tput\n\nGet the terminal size by calling the unix `$ tput` command.\n\n```js\nconsole.log(size.tput());\n```\n\nNote that this method calls [execSync](https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options) to get the size, and must be called directly, as it **is not** called by the main function.\n\n### utils\n\nIn some environments the main export may not be able to find a window size using the default methods. In this case, `size` will be `undefined` and the functions will not be exported.\n\nBecause of this, the functions have been exported in a separate file and can be required directly.\n\n```js\nvar utils = require('window-size/utils');\nconsole.log(utils.win());\n```\n\n## About\n\n### Related projects\n\n* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://github.com/node-base/base-cli) | [homepage](https://github.com/node-base/base-cli \"Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a few plugins, like 'base-store', 'base-options' and 'base-data'.\")\n* [lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://github.com/jonschlinkert/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps \"CLI tool that tells you when dependencies are missing from package.json and offers you a choice to install them. Also tells you when dependencies are listed in package.json but are not being used anywhere in your project. Node.js command line tool and API\")\n* [yargs](https://www.npmjs.com/package/yargs): yargs the modern, pirate-themed, successor to optimist. | [homepage](http://yargs.js.org/ \"yargs the modern, pirate-themed, successor to optimist.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 23 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 11 | [doowb](https://github.com/doowb) |  \n| 4  | [bcoe](https://github.com/bcoe) |  \n| 3  | [icyflame](https://github.com/icyflame) |  \n| 2  | [derhuerst](https://github.com/derhuerst) |  \n| 1  | [karliky](https://github.com/karliky) |  \n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.7.0, on July 27, 2018._","publish_time":1481394069615,"_cnpm_publish_time":1481394069615,"dist-tags":{"latest":"1.1.1"}}