import * as request from 'request' ; import * as path from 'path' ; export function lsGit ( user , repo , dir , callback ) { if ( ! callback ) { callback = dir ; dir = '' ; } let options = { url : `https://api.github.com/repos/${ user }/${ repo }/contents/${ dir }?ref=HEAD` , headers : { 'User-Agent' : 'request' } } ; request . get ( options , callback ) ; } export function getDownloadLink ( user , repo , branch = "master" ) { return `https://github.com/${ user }/${ repo }/archive/${ branch }.zip` ; } export function getFileDownloadLink ( user , repo , dir , file ? ) { if ( file === undefined ) return `https://raw.githubusercontent.com/${ user }/${ repo }/HEAD/${ dir }` ; else return `https://raw.githubusercontent.com/${ user }/${ repo }/HEAD/${ dir }/${ file }` ; }