npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

torrent-stream-vlc

v0.2.1

Published

Insert magnet link or torrent file for streaming directly to VLC (VideoLAN Client) on Mac OS X

Downloads

36

Readme

torrent-stream-vlc

Insert magnet link or torrent file for streaming directly to VLC (VideoLAN Client) on Mac OS X

Built using torrent-stream and inspired by peerflix. Thanks to Mathias Buus.

Prerequisites

  • node + npm
  • VLC for Max OS X (https://www.videolan.org/vlc/download-macosx.html)

Limitations

Due to time and testing constraints, this package was developed only for systems running OS X with VLC player installed. Multiplatform support as well as streaming targets other than VLC might be added later on (If you want to do this yourself, have a closer look at the peerflix package mentioned above).

Usage

Initialise

// import the module
var TorrentStreamVLC = require('torrent-stream-vlc');

// create an instance
var torrentStreamVLC = new TorrentStreamVLC.default();

List files included in torrent and start streaming

// call getFileList with torrent (can be the actual torrent file or a magnet link) to output a list of choices (array) including e.g. file name and index
torrentStreamVLC.getFileList(torrent).then(function(choices) {
  // here you need to select the file to target (video file)
  var fileIndex = 1 // the index of the targeted file

  // start the stream with target index
  torrentStreamVLC.startStream(fileIndex)
})

Stop and delete the currently running stream

// removes and destroys torrent-stream engine, emits 'stream-aborted' event
torrentStreamVLC.destroyTorrent()

Listen to events

// receive notification when stream is ready
torrentStreamVLC.on('stream-ready', function(info) {
  /* info contains: 
    href (address of the stream server)
    storagePath (path to where stream data is temporarily saved)
  */
})

// get stream status updates every 500 ms
torrentStreamVLC.on('stream-status', function(status) {
  /* status contains: 
    downloadSpeed (current download speed)
    uploadSpeed (current upload speed)
    uploadedSize (current upload speed)
    downloadedSize (size of already downloaded pieces)
    downloadedPercentage (percent of file downloaded)
    peersActive (connected peers)
    peersAvailable (available peers)
    streamRuntime (time the stream is already running in seconds)
    hotswaps (hotswap occurences)
    verified (verified pieces)
    invalid (invalid pieces)
    queued (queued peers)
  */
})

// stream-abort happens when vlc was exited
torrentStreamVLC.on('stream-aborted', function() {
  // e.g. exit the process
  process.exit(0)
})

Contribution & Modification

Contribute to this work by improving it or modify the package for your own needs. I recommend working with the included src file and babel:

// install babel-cli and babel-preset-es2015
npm run install-dev

// run this to watch and compile new dist file
npm run dev