Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zonemeen/node-player
π€ A simple command line player for NodeJS on Windows and MacOS
https://github.com/zonemeen/node-player
audio audio-player cli cli-player music music-play music-player node player sound sound-player
Last synced: 27 days ago
JSON representation
π€ A simple command line player for NodeJS on Windows and MacOS
- Host: GitHub
- URL: https://github.com/zonemeen/node-player
- Owner: zonemeen
- License: mit
- Created: 2022-01-07T03:29:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-16T12:18:08.000Z (about 2 years ago)
- Last Synced: 2024-10-13T10:13:21.287Z (about 1 month ago)
- Topics: audio, audio-player, cli, cli-player, music, music-play, music-player, node, player, sound, sound-player
- Language: TypeScript
- Homepage:
- Size: 4.49 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-player
A simple command line player for NodeJS on `Windows` and `MacOS`.
Support .mp3, .wav, .flac and other extensions.
## Install
```sh
npm install @miqilin21/node-player
```or
```sh
yarn add @miqilin21/node-player
```## Usage Examples
cjs:
```sh
const { Player } = require('@miqilin21/node-player')
const player = new Player()
```esm:
```sh
import { Player } from '@miqilin21/node-player'
const player = new Player()
```### Relative path
cjsοΌ
```sh
const path = require('path')
const filePath = path.join(__dirname, 'file.mp3')
player.play(filePath)
```esmοΌ
```sh
import path from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const filePath = path.join(__dirname, 'foo.mp3')
player.play(filePath)
```### Absolute path
```sh
player.play('C:\\file.mp3')
```### Adjusting volume
```sh
/**
* 0 = silent
* 0.5 = default
* 1 = max volume
*/
const volume = 0.1
player.play('file.mp3', volume)
```### Kill process
```sh
player.kill()
```## License
Released under [MIT](/LICENSE) by [@zonemeen](https://github.com/zonemeen).