icecast-sdk-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.11-beta • Public • Published

Icecast SDK for JavaScript

Version

NodeJS / Typescript SDK for Icecast APIs

Icecast APIs

https://icecast.org/docs/icecast-trunk/server_stats/
https://icecast.org/docs/icecast-trunk/admin_interface/

Install

Use npm to install the module

npm install icecast-sdk-js

Or use yarn to install the module

yarn add icecast-sdk-js

Usage

Get Stats

import IcecastServer from 'icecast-sdk-js'

const hostUrl = 'http://locahost:8000'
const ic = new IcecastServer(hostUrl)

;(async () => {
  const stats = await ic.getStats()
  console.log(stats)
})()

Update Source Title (Requires Icecast Server admin username and password)

import IcecastServer from 'icecast-sdk-js'

const { IC_HOST, IC_USERNAME, IC_PASSWORD } = process.env || {}
const ic = new IcecastServer(IC_HOST, { username: IC_USERNAME, password: IC_PASSWORD })

;(async () => {
  const mountpoint = 'testmountpoint'
  const title = 'test title'
  try {
    const source = await ic.updateSource(mountpoint, title)
    console.log(source)
  } catch (error) {
    console.log(error.response.data)
  }
})()

Package Sidebar

Install

npm i icecast-sdk-js

Weekly Downloads

1

Version

1.0.11-beta

License

MIT

Unpacked Size

6.53 kB

Total Files

6

Last publish

Collaborators

  • mxwllstn