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

vue-magnet

v2.0.4

Published

Adds a magnet attribute which acts like src, but supports torrent magnet links.

Downloads

14

Readme

vue-magnet

Greenkeeper badge Build Status JavaScript Style Guide npm

Adds the magnet directive which acts like src, but uses torrent magnet links instead of http. Works with <video>, <img>, <audio> tags and more.

Streams large video and audio files before they are fully downloaded.

Install

npm install vue-magnet

const VueMagnet = require('vue-magnet')

Vue.use(VueMagnet)

or use a script tag to include the minified build. Be sure to use the cdn link from rawgit.com for production apps

<script src="https://vuejs.org/js/vue.js"></script>
<!-- Make sure to place it after Vue -->
<script src="https://rawgit.com/KayleePop/vue-magnet/master/vue-magnet.min.js"></script>

The minified script will automatically call window.Vue.use(VueMagnet), so you can start using v-magnet immediately.

A WebTorrent Client instance is created as the global Vue property Vue.WebTorrent. If Vue.WebTorrent already exists before VueMagnet is installed, then VueMagnet will use the existing instance.

Usage

<script>
new Vue({
  el: '#app',
  data: {
    spaceImageMagnetLink:  'magnet:?xt=urn:btih:2e95238d08ef2cc462e8eeb215b5f0f093b1b205&dn=space.jpg&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com'
  },
  methods: {
    logic: function () {
      //logic for after image is loaded
    }
  }
})
</script>
<div id="app">
  <img v-magnet="spaceImageMagnetLink"
  @magnet-loaded="logic()"></img>
</div>

A new &path= query param in the magnet link is supported to specify a specific file in a multi-file torrent

<script>
new Vue({
  el: 'img',
  data: {
    // magnet link to torrent with a video file, subtitle files, and a poster image file named poster.jpg
    sintelMagnet: 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent'
  }
})
</script>
<img v-magnet="sintelMagnet + '&path=poster.jpg'"></img>

A magnet link can be defined on install as well.

const VueMagnet = require('vue-magnet')

Vue.use(VueMagnet, { magnetLink: sintelMagnet })
<img v-magnet="'poster.jpg'"></img>

How it works

This plugin is a declarative and Vue compatible API for WebTorrent's file.renderTo() function documented here