Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mux/mux-node

Package Overview
Dependencies
Maintainers
3
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-node

Mux API wrapper

  • 1.0.0-beta.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76K
decreased by-0.23%
Maintainers
3
Weekly downloads
 
Created
Source

Mux Node SDK

Official Mux API wrapper for Node projects.

This library is intended to provide Mux API convenience methods for applications written in server-side Javascript. Please note that this package uses Mux access tokens and secret keys and is intended to be used in server-side code only.

Not familiar with Mux? Check out https://mux.com/ for more information.

Documentation

See the Mux-Node docs

Installation

npm install @mux/mux-node --save

or

yarn add @mux/mux-node

Usage

To start, you will need a Mux access token and secret for your Mux environment. For more information on where to get an access token, visit the Mux Getting Started guide https://docs.mux.com/docs

Require the @mux/mux-node npm module and create a Mux instance. Your Mux instance will have Data and Video properties that will allow you to access the Mux Data and Video APIs.

const Mux = require('@mux/mux-node');
const muxClient = new Mux(accessToken, secret);
const { Video, Data } = muxClient;

As an example, you can create a Mux asset and playback ID by using the below functions on your Video instance.

// Create an asset
let assetId;
Video.assets.create({ input: 'https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4' })
  .then((res) => {
    const { data } = res.data;
    assetId = data.id;
  });
// Create a playback ID for an asset
Video.playbackIds.create(assetId, { policy: 'public' });

You can access the Mux Data API in the same way by using your Data instance. For example, you can list all of the values across every breakdown for the aggregate_startup_time metric by using the below function.

Data.metrics.breakdown('aggregate_startup_time', { group_by: 'browser' });

Every function will return a chainable Promise. See the Mux-Node docs for a list of all available functions.

Development

Run unit tests: npm test or npm run test:unit

Run integration tests: npm run test:int

Note: running the integration tests will require you to configure the MUX_ACCESS_TOKEN and MUX_SECRET environment variables with your Mux access token and secret.

To generate the ESDocs, run:

./node_modules/.bin/esdoc
open ./docs/index.html

Keywords

FAQs

Package last updated on 30 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc