{"id":13396729,"url":"https://github.com/sindresorhus/terminal-size","last_synced_at":"2025-04-04T20:14:44.294Z","repository":{"id":10971575,"uuid":"67813157","full_name":"sindresorhus/terminal-size","owner":"sindresorhus","description":"Reliably get the terminal window size","archived":false,"fork":false,"pushed_at":"2023-11-04T17:48:25.000Z","size":70,"stargazers_count":141,"open_issues_count":4,"forks_count":15,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T19:09:05.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2016-09-09T16:06:17.000Z","updated_at":"2025-02-27T13:31:27.000Z","dependencies_parsed_at":"2023-11-06T08:32:34.028Z","dependency_job_id":"10521a87-76bc-4405-a872-d8e4b150c83d","html_url":"https://github.com/sindresorhus/terminal-size","commit_stats":null,"previous_names":["sindresorhus/terminal-size","sindresorhus/term-size"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fterminal-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fterminal-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fterminal-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fterminal-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/terminal-size/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242680,"owners_count":20907134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:01:01.418Z","updated_at":"2025-04-04T20:14:44.275Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["命令行","JavaScript","Packages","包"],"sub_categories":["Command-line utilities","命令行实用工具"],"readme":"# terminal-size\n\n\u003e Reliably get the terminal window size\n\nBecause [`process.stdout.columns`](https://nodejs.org/api/tty.html#tty_writestream_columns) doesn't exist when run [non-interactively](http://www.tldp.org/LDP/abs/html/intandnonint.html), for example, in a child process or when piped. This module even works when all the TTY file descriptors are redirected!\n\nConfirmed working on macOS, Linux, and Windows.\n\n## Install\n\n```sh\nnpm install terminal-size\n```\n\n## Usage\n\n```js\nimport terminalSize from 'terminal-size';\n\nterminalSize();\n//=\u003e {columns: 143, rows: 24}\n```\n\n## API\n\n### terminalSize()\n\nReturns an `object` with `columns` and `rows` properties.\n\n## Related\n\n- [terminal-size-cli](https://github.com/sindresorhus/terminal-size-cli) - CLI for this module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fterminal-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fterminal-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fterminal-size/lists"}