@katrieltsepelevish/vmeo
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

Vmeo

A lightweight Vimeo client

Dependecy Installation

pnpm:

> pnpm add @katrieltsepelevish/vmeo

Usage

import * as Path from "path";
import Vmeo, { DownloadOptions } from "@katrieltsepelevish/vmeo";

// Create an instance of the Vimeo Client
const vmeo = new Vmeo();

// Set your Vimeo video URL
const videoUrl = "https://vimeo.com/VIDEO_ID";

// Specify download options
const options: DownloadOptions = {
  quality: "720p",
  outputPath: Path.join(__dirname, "/path/to/save/video.mp4"),
  override: false,
  onProgress: (percentage) => {
    console.log(`Downloading: ${percentage.toFixed(2)}%`);
  },
  onSuccess: () => {
    console.log("Download completed successfully!");
  },
  onFailure: (error) => {
    console.error(`Download failed: ${error.message}`);
  },
};

// Add event listeners
vmeo.on("data", (percentage) => {
  console.log(`Data event received: ${percentage.toFixed(2)}%`);
});

vmeo.on("success", () => {
  console.log("Success event received!");
});

vmeo.on("error", (error) => {
  console.error(`Error event received: ${error.message}`);
});

// Start the download
vmeo.download(videoUrl, options);

Explanation

Event Listeners

  • data: An event that receives the download progress as a percentage
  • success: An event that invokes when the download is completed successfully
  • error: An event that invokes if an error occurs during the download

Download Options

  • quality: Specify the desired video quality ('240p', '360p', '540p', '720p', '1080p')
  • outputPath: The file path where the downloaded video will be saved
  • override: (Optional) Set to true if you want to override an existing file at the specified path
  • onProgress: A callback function that receives the download progress as a percentage
  • onSuccess: A callback function invoked when the download is completed successfully
  • onFailure: A callback function invoked if an error occurs during the download

Publish

Make sure to bump the version before publishing

yarn build
npm publish --access=public

Readme

Keywords

none

Package Sidebar

Install

npm i @katrieltsepelevish/vmeo

Weekly Downloads

1

Version

0.0.0

License

MIT

Unpacked Size

18.5 kB

Total Files

13

Last publish

Collaborators

  • katrieltsepelevish