1.0.0 • Published 5 years ago
sound-play-terminus v1.0.0
sound-play
Dead simple sound player for Node -- because it should be simple.
const sound = require('sound-play')
sound.play('file.mp3')Support
.wav,.mp3and other extensions.Work on
WindowsandMacOS
Install
npm install sound-playyarn add sound-playExamples
Relative path
sound.play('file.mp3')or
const path = require('path')
const filePath = path.join(__dirname, 'file.mp3')
sound.play(filePath)Absolute path
sound.play('C:\\file.mp3')Promise
sound.play('C:\\file.mp3').then(response => console.log('done'))Async/await
try {
await sound.play('C:\\file.mp3')
console.log('done')
} catch (error) {
console.error(error)
}License
MIT
1.0.0
5 years ago