This module is loosely modelled after the scws2 Python module, supporting the 2.x REST API.
const{ ConManager }=require('scjs');constbaseurl="http://localhost/ContentManager";constusername="user";constpassword="pass";constcm=newConManager(baseurl);(async()=>{constresp=awaitcm.login(username,password);try{constplayers=awaitcm.get('players',{'limit': 0,'offset': 0,'fields': 'id,name,enabled,active,type'});console.log(players.list);constmedia=awaitcm.get('media',{'limit': 10,'filters': '{"type":{"values":["IMAGE"]}}'});letitems=[];for(constitemofmedia.list){items.push(cm.download(item.downloadPath,item.name));}awaitPromise.all(items);constitem=awaitcm.upload('LocalFolder/MyPicture.jpg','RemoteFolder/MyPicture.jpg');console.log(item);}finally{awaitcm.post('auth/logout');}})().catch((e)=>{console.log(e);});