{"id":24589274,"url":"https://github.com/arciiix/easy-volume","last_synced_at":"2025-04-30T05:06:53.700Z","repository":{"id":181666013,"uuid":"664776375","full_name":"Arciiix/easy-volume","owner":"Arciiix","description":"The easiest way to get and control your system's volume is finally here","archived":false,"fork":false,"pushed_at":"2023-08-01T10:02:30.000Z","size":309,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T05:06:36.799Z","etag":null,"topics":["control","electron","loudness","speaker","volume"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/easy-volume?activeTab=readme","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/Arciiix.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,"governance":null}},"created_at":"2023-07-10T18:12:03.000Z","updated_at":"2024-05-02T01:53:25.000Z","dependencies_parsed_at":"2023-09-30T17:34:45.029Z","dependency_job_id":null,"html_url":"https://github.com/Arciiix/easy-volume","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"2a0c40fde82cae14e2dc0ab47bfecaa21ddd4422"},"previous_names":["arciiix/easy-volume"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arciiix%2Feasy-volume","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arciiix%2Feasy-volume/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arciiix%2Feasy-volume/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arciiix%2Feasy-volume/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arciiix","download_url":"https://codeload.github.com/Arciiix/easy-volume/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644842,"owners_count":21620634,"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":["control","electron","loudness","speaker","volume"],"created_at":"2025-01-24T08:14:37.129Z","updated_at":"2025-04-30T05:06:53.653Z","avatar_url":"https://github.com/Arciiix.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy-volume\n[![npm](https://img.shields.io/npm/dt/easy-volume.svg)](https://www.npmjs.com/package/easy-volume?activeTab=readme)\n\nControlling system volume level in Node.js **has never been easier**!\n\nThis **cross-platform**, dependency-free library lets you **control and get the status of volume** in your system. **No matter what OS or what framework** (it works everywhere - as well as on regular Node.js and Electron - where they were tested), you don't have to worry about the compatibility and potential errors - this library will **handle it all.**\n\nNote that this library solves the Electron production-build specific problem with asar-packed files - other libraries similar to this, which have to call executable file or native module, don't work on Electron - **easy-volume, on the other hand, was designed (and tested) to work with Electron like a charm!**\n\n## Usage\n```typescript\nimport { setVolume, getVolume, setMute, getMute } from \"easy-volume\";\n\n// Set volume - value from 0 to 100%\nawait setVolume(20);\n\n// Get volume - value from 0 to 100%\nconst volume: number = await getVolume();\nconsole.log(volume); // 20\n\n// Set mute - true is muted and false is unmuted\nawait setMute(true);\n\n// Get current mute status - true if system audio is muted, otherwise false\nconst isMuted: boolean = await getMute();\nconsole.log(isMuted); // true\n```\n\n\n## API\n```getVolume(): Promise\u003cnumber\u003e```\n* Get current system volume\n* **Returns**: System volume, from 0 to 100 [%]\n\n```setVolume(targetValue: number) =\u003e Promise\u003cvoid\u003e```\n* Change system volume to target value\n* **Param** *targetValue*: Target volume, from 0 to 100\n\n```getMute(): Promise\u003cboolean\u003e```\n* Get current mute status (whether the system audio is muted or not)\n* **Returns**: Whether the system audio is muted, i.e. true == muted, false == unmuted\n \n\n```setMute(isMuted: boolean) =\u003e Promise\u003cvoid\u003e```\n* Either mute or unmute system audio\n* **Param** *isMuted*: Whether to mute or unmute the system audio\n   \n```toggleMute() =\u003e Promise\u003cvoid\u003e```\n* Toggle mute state\n* **Returns**: Current (new) mute state (true == muted, false == unmuted)\n\n\n## Compatibility\n### This library should be compatible with every of the most popular OS:\n* **Windows** (uses **native C++ CLI tool** I wrote by myself (see [```src/platforms/windows/main.cpp```](src/platforms/windows/main.cpp)))\n* **macOS** (uses **AppleScript (osascript)**)\n* **Linux** (uses **Advanced Linux Sound Architecture (ALSA, amixer)** - installed by default on most Linux distros)\n### Tested on:\n* Windows 11 22H2\n* macOS Ventura 13.4\n* Ubuntu 22.04.2 LTS\n\n## Test\nYou can test the library on your setup by running this command:\n```bash\nnpm test\n```\nIf any of the test fails or you're using another setup which isn't implemented here, feel free to create an issue or a pull request.\n\nFeel free to give some ideas for future features by creating issues on the [GitHub repository](https://github.com/Arciiix/easy-volume).\n\n## Building\nTo build the library, just run simple\n```bash\nnpm run build\n```\n**IMPORTANT**: After building, be sure to copy ```src/platforms/windows/volume.exe``` into ```dist/platforms/windows/volume.exe```\n\n## Creating own implementations\nIf you're using a different setup and/or want to create your own implementation of the library, feel free to make a pull request.\n\n1. In ```src/platforms```, create a new directory with the name of your target platform.\n1. In your newly created directory, create index.ts file which exports an object of type ```PlatformImplementation``` (see its declaration in [```src/types.ts```](src/types.ts)).\n1. Create your custom implementation. Note: if you're calling some native modules or any files, make sure to surround your path with the ```toElectronPath``` function from [```src/utils/toElectronPath.ts```](src/utils/toElectronPath.ts).\n1. In the [```src/index.ts```](src/index.ts) file, add a special case to the ```switch``` statement with your platform, following the patterns in the file.\n1. Before creating the pull request, please test the library (see above for running tests).\n\nMade with ❤️ by [Artur Nowak](https://github.com/Arciiix)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farciiix%2Feasy-volume","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farciiix%2Feasy-volume","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farciiix%2Feasy-volume/lists"}