@miqilin21/node-player
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

node-player

A simple command line player for NodeJS on Windows and MacOS.

Support .mp3, .wav, .flac and other extensions.

Install

npm install @miqilin21/node-player

or

yarn add @miqilin21/node-player

Usage Examples

cjs:

const { Player } = require('@miqilin21/node-player')
const player = new Player()

esm:

import { Player } from '@miqilin21/node-player'
const player = new Player()

Relative path

cjs:

const path = require('path')
const filePath = path.join(__dirname, 'file.mp3')
player.play(filePath)

esm:

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

player.play('C:\\file.mp3')

Adjusting volume

/**
 * 0   = silent
 * 0.5 = default
 * 1   = max volume
 */
const volume = 0.1
player.play('file.mp3', volume)

Kill process

player.kill()

License

Released under MIT by @zonemeen.

Package Sidebar

Install

npm i @miqilin21/node-player

Weekly Downloads

0

Version

1.0.11

License

MIT

Unpacked Size

6.89 kB

Total Files

6

Last publish

Collaborators

  • miqilin21