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

@videoguys/javascript-client

v0.2.2

Published

official javascript client

Downloads

5

Readme

videoguys-javascript-client

Official API

  • API version: 0.1
  • Package version: 0.1.0

Requirements.

NodeJS 8.11.4+

NodeJS

To install this package you must have NodeJS installed, please follow those instructions for your OS before attempting to use this package.

NPM

Install via NPM (easiest method).

npm install --save @videoguys/javascript-client

Then import the package:

const videoguys = require('@videoguys/javascript-client');

Basic Usage

Please follow the installation procedure and then you may run any of the following:

const videoguys = require('@videoguys/javascript-client');

const api_client = new videoguys.ApiClient({
  api_host: "[vevio|vidup]",
  api_token: "<api_key>"
});

(async() => {
  try{
    const pair_response = api_client.getVideoPair("<video_code>");
    console.log(pair_response);
    
    const video_info = api_client.getVideoInfo("<video_code>");
    console.log(video_info);
    
    const filepath = "absolute_path_to_file";
    const video_upload = api_client.uploadVideo({
      filepath: filepath, // required filepath for the new video upload
      // size: size, // optional in this function, filepath will auto determine the size
      title: title, // optional title for the new video
      description: description, // optional description for the new video
      folder_id: folder_id, // optional folder_id for the new video
      lite: lite, // optional lite setting for the new video [0 or 1]
      public: public, // optional public setting for the new video [0 or 1]
    });
    console.log(video_upload);

    const video_uploads = api_client.getVideoUploads();
    console.log(video_uploads);

    const video_upload = api_client.updateVideoUpload(
      <upload_code>,
      {
        title: title, // optional new title for the new video
        description: description, // optional new description for the new video
        folder_id: folder_id, // optional new folder_id for the new video
        lite: lite, // optional new lite setting for the new video [0 or 1]
        public: public, // optional new public setting for the new video [0 or 1]
      }
    );
    console.log(video_upload);

    const video_upload = api_client.getVideoUpload("<upload_code>");
    console.log(video_upload);

    const deleted_video_upload = api_client.deleteVideoUpload("<upload_code>");
    console.log(deleted_video_upload);

    const url = "http/https file url";
    const url_upload = api_client.newUrlUpload({
      url: url, // required url for the new url upload
      title: title, // optional title for the new url
      description: description, // optional description for the new url
      folder_id: folder_id, // optional folder_id for the new url
      lite: lite, // optional lite setting for the new url [0 or 1]
      public: public, // optional public setting for the new url [0 or 1]
    });
    console.log(url_upload)
    
    const url_uploads = api_client.getUrlUploads();
    console.log(url_uploads);

    const url_upload = api_client.updateUrlUpload(
      <upload_code>
      {
        title: title, // optional new title for the new url
        description: description, // optional new description for the new url
        folder_id: folder_id, // optional new folder_id for the new url
        lite: lite, // optional new lite setting for the new url [0 or 1]
        public: public, // optional new public setting for the new url [0 or 1]
      }
    );
    console.log(url_upload);

    const url_upload = api_client.getUrlUpload("<upload_code>");
    console.log(url_upload);

    const url_upload_status = api_client.getUrlUploadStatus("<upload_code>");
    console.log(url_upload_status);

    // if the url upload has been downloaded then you should clear it
      // to avoid concurrent hitting limits
    if (
        url_upload_status
        && 'status' in url_upload_status
        && url_upload_status['status'] == "downloaded"
      ){
      const deleted_url_upload = api_client.deleteUrlUpload("<upload_code>");
      console.log(deleted_url_upload);
    }

    const videoDownload = await client.downloadVideo({
      code: "<video_code>",
      filepath: "<destination_filepath>"
    });

    let clientDownloadInterval = setInterval(() => {
      let clientProgress = videoDownload.hasProgress();
      if(clientProgress){
        /*
          the progress object looks like this:
          {
            percent: 0.5,               // Overall percent (between 0 to 1)
            speed: 554732,              // The download speed in bytes/sec
            size: {
                total: 90044871,        // The total payload size in bytes
                transferred: 27610959   // The transferred payload size in bytes
            },
            time: {
                elapsed: 36.235,        // The total elapsed seconds since the start (3 decimals)
                remaining: 81.403       // The remaining seconds to finish (3 decimals)
            }
          }
        */ 
        console.log('download progress', clientProgress);
      }

      let clientError = videoDownload.hasError();
      if(clientError){
        console.error('download error', clientError);
        clearInterval(clientDownloadInterval);
      }

      let clientCompleted = videoDownload.hasCompleted();
      if(clientCompleted){
        console.log('download completed', clientCompleted);
        clearInterval(clientDownloadInterval);
      }

      if(!clientProgress && !clientError && !clientCompleted){
        console.log('download has likely not been started yet');
      }
    }, 2500);

    videoDownload.start();
  }catch(err){
    console.error('err', err);
  }
})();

Documentation For Authorization

All endpoints except getVideoInfo("<video_code>") and getVideoPair("<video_code>") requires authorization.

Author

VideoGuys