{"size": 781, "ext": "js", "max_stars_repo_path": "demos/video_upload_multiple.js", "max_stars_repo_name": "Ziggeo/ZiggeoNodeSdk", "max_stars_repo_stars_event_min_datetime": "2016-04-11T06:20:17.000Z", "max_stars_repo_stars_event_max_datetime": "2017-03-31T20:38:16.000Z", "max_issues_repo_path": "demos/video_upload_multiple.js", "max_issues_repo_name": "Ziggeo/ZiggeoNodeSdk", "max_issues_repo_issues_event_min_datetime": "2021-02-18T11:29:08.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-23T19:58:14.000Z", "max_forks_repo_path": "demos/video_upload_multiple.js", "max_forks_repo_name": "Ziggeo/ZiggeoNodeSdk", "max_forks_repo_forks_event_min_datetime": "2015-08-12T21:18:19.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-24T07:05:02.000Z"}
{"max_stars_count": 6, "max_issues_count": 1, "max_forks_count": 5, "avg_line_length": 21.1081081081, "max_line_length": 57, "alphanum_fraction": 0.6658130602}

var fs = require("fs");

var app_token = process.argv[2];
var private_key = process.argv[3];
var folder_name = process.argv[4];
var tags = process.argv[5];
var ignore_list = ".,.."; // don't try to upload . and ..
var file_list = [];

if(tags === undefined || tags === ''){
	tags = 'NodeBulkImport';
}

if(folder_name.slice(-1) !== '/'){
	folder_name = folder_name+'/';
}

var Ziggeo = require("../index.js");
var ZiggeoSdk = new Ziggeo(app_token, private_key);

fs.readdirSync (folder_name).forEach(file => {
  file_list.push(file);
});
uploadSingleFile();

function uploadSingleFile(){
	if(file_list.length == 0){
		return;
	}
	var file_to_upload = file_list.shift();
	ZiggeoSdk.Videos.create({
		file: folder_name+file_to_upload
	}, function(data){
		uploadSingleFile();
	});
}