{"id":16828004,"url":"https://github.com/hyperlink/ups-status","last_synced_at":"2025-03-17T20:29:19.714Z","repository":{"id":57117016,"uuid":"427798582","full_name":"hyperlink/ups-status","owner":"hyperlink","description":"Node.Js API to get status of UPS connected to your MacOS","archived":false,"fork":false,"pushed_at":"2021-11-16T13:17:28.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T12:41:25.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/hyperlink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-13T23:57:25.000Z","updated_at":"2023-04-11T15:42:02.000Z","dependencies_parsed_at":"2022-08-22T22:20:23.477Z","dependency_job_id":null,"html_url":"https://github.com/hyperlink/ups-status","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fups-status","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fups-status/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fups-status/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fups-status/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperlink","download_url":"https://codeload.github.com/hyperlink/ups-status/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244105251,"owners_count":20398831,"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-10-13T11:24:04.850Z","updated_at":"2025-03-17T20:29:19.695Z","avatar_url":"https://github.com/hyperlink.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UPS Status 🔌 for Node JS\n![Version](https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000)\n[![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](#)\n[![Twitter: hyperlink](https://img.shields.io/twitter/follow/hyperlink.svg?style=social)](https://twitter.com/hyperlink)\n\nNode.Js API to get status of UPS connected to your MacOS\n\n## Install\n\n```sh\nnpm install @hyperlink/ups-status\n```\n\n## Usage\n\nTwo different ways to use this module. You can Promise interface or EventEmitter interface.\n\n### Promise interface\n\n```js\nimport { isOnBattery, isOnAc } from '@hyperlink/ups-status';\n\n// in some async function\nif (await isOnBattery()) {\n  console.log('Mac is running on Battery');\n} else {\n  console.log('Mac is on AC');\n}\n\n// or\n\n// in some async function\nif (await isOnAc()) {\n  console.log('Mac is on AC');\n  } else {\n  console.log('Mac is running on Battery');\n}\n```\n\n### EventEmitter interface.\n\n`UpsEmitter` will emit `'ac'` event with `true` or `false` value when AC is connected or not.\n\n```js\nimport { UpsEmitter } from '@hyperlink/ups-status';\n\nconst ups = new UpsEmitter();\nups.on('ac', isOnAc =\u003e console.log('computer is on ac:', isOnAc));\n```\n\n\n## Author\n\n👤 **Xiaoxin Lu \u003cjavascript@yahoo.com\u003e**\n\n* Twitter: [@hyperlink](https://twitter.com/hyperlink)\n* Github: [@hyperlink](https://github.com/hyperlink)\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperlink%2Fups-status","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperlink%2Fups-status","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperlink%2Fups-status/lists"}