npm.io
1.2.0 • Published 4 years ago

@hushpoison/vimeo-api

Licence
MIT
Version
1.2.0
Deps
2
Size
34 kB
Vulns
24
Weekly
0
Stars
3

npm License

Interacting with the Vimeo API using Node.js

Get started with the Vimeo API

Install the Node.js library

To install Node.js, run the following command:

 npm install @hushpoison/vimeo-api
 vimeoUploadLink(fileLength: number, fileName: string)
Upload Video Blob (url = genarated url from above function)
 uploadBlob(file: Buffer, url: string, s:() => void , e:(error:string) => void)
Get Thubnails
 thumbnailForPrivateVideo(id: string, thumbnailWidth: number)
 thumbnailForPublicVideo(id: string, thumbnailWidth: VideoSize)
Delete video(id = vimeo video id)
 deleteVideo(id: string)
Insert Video To Folder in Vimeo
 moveToFolder(id: string, folderId: string)

Advanced examples

let data = readFileSync('./lib/example/mnv.mp4');
const t = Vimeo({
  token: '--------------------',
});

(async () => {
  try {
    const {uploadLink,uri,videoUrl} = await t.vimeoUploadLink(filesize, 'filename'); //filesize is (buffer length) size of the upload file
     t.uploadBlob(file,uploadLink,()=>console.log(success),(e:string)=>console.log(error)) //file must be buffer or blob
  } catch (error) {
    console.log(error);
  }
})();

(async () => {
  try {
    const c = await t.transcodeStatus('726466895');
    const y = await t.thumbnailForPrivateVideo('726466895', 640);
  } catch (error) {
    console.log(error);
  }
})();

Credits

https://github.com/Applicafroguy/vimeo-uploader

Keywords