Socket
Socket
Sign inDemoInstall

fetch-video

Package Overview
Dependencies
72
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fetch-video

fetching (downloading) video by uri, using wget or hls-fetch for .m3u8 to specified outfile


Version published
Maintainers
1
Install size
10.3 MB
Created

Readme

Source

fetch-video

m3u8 HLS Stream or video file url downloading to mp4 file with autodetect of url type

Installation

npm i fetch-video

Usage

  const { download } = require('fetch-video');
  
  const downloader = download(url, filename, requestOptions);
  downloader.on('progress', progress => console.log(`Current progress ${progress}`));
  downloader.on('speed', speed => console.log(`Current speed ${speed}`));
  downloader.on('stats', console.log.bind(console));
  downloader.go() // Promise returned 
    .then(() => console.log(`video stream or file ${url} is downloaded and stored as the ${filename}`));

download(url, filename, requestOptions) => downloader

url - url of your video file or m3u8 playlist

filename - filename path to which you want save the video. Can be stream. If undefined - then dev-null stream used.

requestOptions - request options

downloader.go() => Promise

Launches downloading and Promise being resolved on finish.

downloader.abort()

Immediately aborts downloading

downloader.on(name, handler)

Subscribe for event. Currently it supports two events:

  • progress => sending progress percents as payload
  • speed => sending current speed in bytes per second as payload
  • stats => sending full stats about progress
  • lastSegmentStats => stats about time, size and speed of last segment
  • response => time elapased between request started and headers got

FAQs

Last updated on 06 Mar 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc