| 
					
				 | 
			
			
				@@ -387,13 +387,15 @@ function getErrorMessage(error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (error.response && error.response.status && error.response.statusText && error.response.data  && error.response.data.error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // console.log(error.response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('=============================== Axios Error ===============================') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('발생시각 : '+ new Date().toLocaleString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log(error.response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log(error.response.data.error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     errorText = `status : ${error.response.status} - ${error.response.statusText}<br>message : ${error.response.data.error.message}`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('================================ Error =====================================') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('발생시각:'+ new Date().toLocaleString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('에러 : '+ error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     errorText = error;  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return errorText; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -738,20 +740,35 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return res.json(uploadDriveResult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        const promiseArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        const labelPromiseArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        const fileWriteArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        const possibleExt = POSSIBLE_EXT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        const {supported_file_ext, protected_file_ext} = possibleExt; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let supportedArr = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (supported_file_ext && protected_file_ext) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          supportedArr = supported_file_ext.split(';'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if (!supportedArr[supportedArr.length - 1]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            supportedArr.splice(supportedArr.length - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (files && files.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let fileWriteTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (files && files.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const promiseArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const labelPromiseArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const fileWriteArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const possibleExt = POSSIBLE_EXT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const {supported_file_ext, protected_file_ext} = possibleExt; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let supportedArr = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let protectedArr = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let protectedMap = new Map(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (supported_file_ext && protected_file_ext) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            supportedArr = supported_file_ext.split(';'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            protectedArr = protected_file_ext.split(';'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!supportedArr[supportedArr.length - 1]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              supportedArr.splice(supportedArr.length - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!protectedArr[protectedArr.length - 1]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              protectedArr.splice(protectedArr.length - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (protectedArr.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              for (let array of protectedArr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                array = array.split('-'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (array.length === 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  protectedMap.set(array[0], array[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           let beforeUri = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           let beforeItemId = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -762,13 +779,13 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             file.originalname = Buffer.from(file.originalname, 'ascii').toString('utf8'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let originName = file.originalname; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (originName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              const ext = globalPath.extname(originName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              if (supportedArr.length > 0 && !supportedArr.includes(ext)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  return res.json({success:'F', message: '파일명 : ' + originName  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    +'<br>해당 파일은 업로드 불가 파일입니다. 다시 시도해주세요.<br>가능 확장자 :'  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    + JSON.stringify(supportedArr)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let ext = globalPath.extname(originName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (supportedArr.length > 0 && !supportedArr.includes(ext)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return res.json({success:'F', message: '파일명 : ' + originName  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      +'<br>해당 파일은 업로드 불가 파일입니다. 다시 시도해주세요.<br>가능 확장자 :'  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      + JSON.stringify(supportedArr)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const uuid = uuidv4(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const realFileName = uuid + ext; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -779,32 +796,34 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //fileWriteArray.push(['Z:/Source/' + realFileName, file.buffer]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //fs.writeFileSync('Z:/Source/' + realFileName, file.buffer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const base64Data = Buffer.from(file.buffer).toString('base64'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const param = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   apiKey: gateWayKey, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   email: req.session.account.idTokenClaims.email, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   dispFileName: originName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  aipGuid: "878173ae-cc36-4881-af57-604af868314c", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  comment: "set-label", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  // aipGuid: "878173ae-cc36-4881-af57-604af868314c", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  aipGuid: "0166b75f-6a93-47f3-8fd3-e1e7c59141ab", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  comment: "set-protection", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   fileData: base64Data, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // console.log(realFileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // console.log(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // labelPromiseArray.push(axios.post(apiUrl + '/api/v1/file/set-label', param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                labelPromiseArray.push(axios.post(apiUrl + '/api/v1/stream/set-label', param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // labelPromiseArray.push(axios.post(apiUrl + '/api/v1/stream/set-label', param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                labelPromiseArray.push(axios.post(apiUrl + '/api/v1/stream/set-protection', param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let formatPath = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (file_path[idx]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  if (!path.includes(":")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    formatPath = ":" + file_path[idx]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  console.log(file_path[idx]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  if (!path.includes(":")) {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    formatPath = ":" + file_path[idx];  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    formatPath = file_path[idx]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let itemId = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const uri = endPoint + "/sites/"+ siteId + path + formatPath; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (beforeUri === uri) {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   itemId = beforeItemId; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -821,14 +840,19 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     res.json({success:'F', message: '파일 업로드 작업 중 오류가 발생했습니다.<br>에러 : ' + JSON.stringify(error.message)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (protectedMap.size > 0 && protectedMap.get(ext)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  let name = originName.replace(ext, ''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  ext = protectedMap.get(ext); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  originName = name + ext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 promiseArray.push(endPoint + "/sites/"+ siteId +"/drive/items/"+itemId+':/'+originName+':/content'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              let fileWriteTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              const writeArr = await Promise.all(fileWriteArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              //file write 시 사용 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              //const writeArr = await Promise.all(fileWriteArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               let writeTime = timeCheck(fileWriteTime, new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               console.log('파일 Write Time : '+ writeTime); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -836,14 +860,19 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               const labelTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               const labelResult = await Promise.all(labelPromiseArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              // console.log(labelResult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              console.log(labelResult[0].data.result.fileData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               console.log('label time : ', timeCheck(labelTime, new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               labelResult.forEach((obj, idx)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log(obj.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (obj.data && !obj.data.result.errorCode && obj.data.result.fileData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   const data = Buffer.from(obj.data.result.fileData, 'base64'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  console.log(obj.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   promiseArray[idx] = axios.put(promiseArray[idx], data, options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  throw '파일명 : '+obj.data.result.dispFileName + '<br>에러 : ' + obj.data.result.errorMessage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               // const readArray = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               // labelResult.forEach((obj)=>{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -886,109 +915,15 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return res.json({success:'F', message: '요청하신 파일 업로드 중 오류가 발생하였습니다.<br>' + getErrorMessage(error)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          let betweenTime = timeCheck(startTime, endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', betweenTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          res.json({success:'S', message: '요청하신 파일 업로드가 정상적으로 처리 되었습니다.'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // let fileReadTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const result = await Promise.all(labelPromiseArray).then((result)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   const array = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   for (let item of result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     const obj = item.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     if (obj.success && !obj.result.errorCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       // console.log(obj.result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       const labelFile = fs.readFileSync('Z:/Target/' + obj.result.outputFileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       array.push({success:'S', dispFileName: obj.result.dispFileName, outputFileName : obj.result.outputFileName, file: labelFile}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       array.push({success:'F', message: '요청하신 파일 업로드 중 오류가 발생하였습니다.<br>' + obj.result.errorMessage}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   return array; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const array = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const result = await Promise.all(labelPromiseArray).then(async (result)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   return await Promise.all(result.map((item, idx)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     const obj = item.data;   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     if (obj.success && !obj.result.errorCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       fs.readFile('Z:/Target/' + obj.result.outputFileName, (err, data)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //         if (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //           throw err; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //         promiseArray[idx] = axios.put(promiseArray[idx], data, options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       throw obj.result.errorMessage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   })).then(async()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     return await Promise.all(promiseArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const result = await Promise.all(promiseArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // console.log(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // console.log('파일 Read 소요시간 : '+timeCheck(fileReadTime, new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // console.log(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const array = await Promise.all(result.map((item, idx)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   const obj = item.data;   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   if (obj.success && !obj.result.errorCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     fs.readFile('Z:/Target/' + obj.result.outputFileName, (err, data)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       if (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //         throw err; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       promiseArray[idx] = axios.put(promiseArray[idx], data, options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       return {success:'S', dispFileName: obj.result.dispFileName, outputFileName : obj.result.outputFileName, file: data}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     return {success:'F', message: '요청하신 파일 업로드 중 오류가 발생하였습니다.<br>' + obj.result.errorMessage}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const errorIdx = array.findIndex((obj)=> obj.success === 'F'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // if (errorIdx >= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   return res.json(array[errorIdx]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // for (let ii = 0; ii < result.length; ii++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   const obj = result[ii].data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   if (obj.success && !obj.result.errorCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     // console.log(obj.result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     const labelFile = fs.readFileSync('Z:/Target/' + obj.result.outputFileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     array.push({success:'S', dispFileName: obj.result.dispFileName, outputFileName : obj.result.outputFileName, file: labelFile}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     array.push({success:'F', message: '요청하신 파일 업로드 중 오류가 발생하였습니다.<br>' + obj.result.errorMessage}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // console.log(array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // console.log('파일 Read 소요시간 : '+timeCheck(fileReadTime, new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // return res.json({success: 'F', message: 'test'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // if (result && result.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     for (let ii=0; ii < result.length; ii++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       if (result[ii] && result[ii].success === 'S') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //         promiseArray[ii] = axios.put(promiseArray[ii], result[ii].file, options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //         return res.json(result[ii]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // .catch((error)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   console.log('=========================에러=================') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   console.log(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              // return res.json({success:'F', message: '요청하신 파일 업로드 중 오류가 발생하였습니다.<br>' + getErrorMessage(error)}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // let uploadTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const uploadResult = await Promise.all(promiseArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // const uploadBetween = timeCheck(uploadTime, new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // console.log('upload 소요 시간:'+uploadBetween); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let betweenTime = timeCheck(startTime, endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', betweenTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        res.json({success:'S', message: '요청하신 파일 업로드가 정상적으로 처리 되었습니다.'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return res.json({success:'F', message: '업로드 요청 파라미터 정보를 확인해 주세요.'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function timeCheck(startTime, endTime) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1004,8 +939,6 @@ function timeCheck(startTime, endTime) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/download', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       let startTime = new Date(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1018,39 +951,37 @@ serverApp.post('/api/download', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const downObj = await getFolderItems(url, arr, options, req.session); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const folderLength = downObj.folder.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const fileLength = downObj.files.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if (downObj && (folderLength > 1 || fileLength > 1 || (folderLength + fileLength) > 1)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            createZipFile(downObj, zip); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            const now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            const year = now.getFullYear().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let month = now.getMonth() + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (month < 10) month = "0" + month; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let date = now.getDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (date < 10) date = "0" + date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            zip.generateAsync({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              type: 'nodebuffer', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              mimeType: 'application/epub+zip', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              compression: 'DEFLATE', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              compressionOptions: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                level: 9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }).then((resZip)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', timeCheck(startTime, endTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              return res.json({success: 'S', data: resZip, name: zipName + '_' + year + '-' + month + '-' + date + '.zip'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            .catch((error)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              console.log(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              return res.json({success: 'F', message:'파일 다운로드 중 오류가 발생하였습니다.', error: error}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          else if (downObj.folder.length > 0 && downObj.files.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return res.json({success:'F', messages:'폴더안에 파일이 존재하지 않습니다.'}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          else if (downObj.files.length === 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            const data = downObj.files[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            console.log(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return res.json({success: 'S', data: data.data, name: data.name}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (downObj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (folderLength > 0 || fileLength > 1 ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              createZipFile(downObj, zip); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              const now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              const year = now.getFullYear().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              let month = now.getMonth() + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if (month < 10) month = "0" + month; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              let date = now.getDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if (date < 10) date = "0" + date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              zip.generateAsync({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                type: 'nodebuffer', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                mimeType: 'application/epub+zip', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                compression: 'DEFLATE', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                compressionOptions: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  level: 9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }).then((resZip)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', timeCheck(startTime, endTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return res.json({success: 'S', data: resZip, name: zipName + '_' + year + '-' + month + '-' + date + '.zip'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              .catch((error)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return res.json({success: 'F', message:'파일 다운로드 중 오류가 발생하였습니다.', error: error}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else if (downObj.files.length === 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              const data = downObj.files[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              const bufferData = Buffer.from(data.data, 'base64'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              return res.json({success: 'S', data: bufferData, name: data.name}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1063,152 +994,6 @@ serverApp.post('/api/download', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// serverApp.post('/api/download', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//       let startTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//       if (req.body) {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         const {siteId, path, fileIds, zipName} = req.body; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         if (siteId && path && fileIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//           const options = getOptions(req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//           const arr = JSON.parse(fileIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//           if (arr.length === 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             const sitesInfo = await axios.get(endPoint + "/sites/"+ siteId + "/drive/items/" + arr[0], options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             if (sitesInfo && sitesInfo.data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               const data = sitesInfo.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               if (data.folder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   const folderObj = await getFolderItems(endPoint + "/sites/"+ siteId + "/drive/items/", arr, options, req.session); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   // return res.json({success: 'F', message:'test', obj : folderObj}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   const zip = new JSZIP(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   if (folderObj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     createZipFile(folderObj, zip); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     const now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     const year = now.getFullYear().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     let month = now.getMonth() + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     if (month < 10) month = "0" + month; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     let date = now.getDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     if (date < 10) date = "0" + date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     zip.generateAsync({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       type: 'nodebuffer', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       mimeType: 'application/epub+zip', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       compression: 'DEFLATE', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       compressionOptions: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                         level: 9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     }).then((resZip)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       let betweenTime = endTime - startTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       if (betweenTime > 60000) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                         betweenTime = (betweenTime/1000/60) + ' 분'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       else {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                         betweenTime = (betweenTime/1000) + ' 초';        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', betweenTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       return res.json({success: 'S', data: resZip, name: data.name + '_' + year + '-' + month + '-' + date + '.zip'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     .catch((error)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       console.log(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       return res.json({success: 'F', message:'파일 다운로드 중 오류가 발생하였습니다.', error: error}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               const dataUrl = data['@microsoft.graph.downloadUrl']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               const response = await axios.get(dataUrl, {responseType: 'arraybuffer', headers: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 withCredentials:true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               },}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               if (response.data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 const file = Buffer.from(response.data, 'arraybuffer').toString('base64'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 let decodeFile = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   const param = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     apiKey: gateWayKey, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     email : req.session.account.idTokenClaims.email, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     dispFileName: data.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     comment: "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     fileData: file 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   const result = await axios.post(apiUrl + '/api/v1/stream/delete-label', param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   if (result && result.data.statusCode === 200 && !result.data.result.errorCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       decodeFile = result.data.result.fileData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                       return res.json({message: '파일명 : ' +data.name + '<br>에러 : ' + result.data.result.errorMessage, success: 'F'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 catch(error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   return res.json({message: '레이블 해제 중 오류가 발생하였습니다.<br>' + JSON.stringify(error.message), success: 'F'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 let betweenTime = endTime - startTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 if (betweenTime > 60000) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   betweenTime = (betweenTime/1000/60) + ' 분'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   betweenTime = (betweenTime/1000) + ' 초';        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', betweenTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 return res.json({success: 'S', data: decodeFile, type: data.file.mimeType, name: data.name}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 return res.json({message:'파일 다운로드에 실패하였습니다.', success:'F'}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               const url = endPoint + "/sites/"+ siteId + "/drive/items/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               const zip = new JSZIP(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               const downObj = await getFolderItems(url, arr, options, req.session); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               if (downObj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 createZipFile(downObj, zip); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 const now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 const year = now.getFullYear().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 let month = now.getMonth() + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 if (month < 10) month = "0" + month; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 let date = now.getDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 if (date < 10) date = "0" + date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 zip.generateAsync({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   type: 'nodebuffer', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   mimeType: 'application/epub+zip', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   compression: 'DEFLATE', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   compressionOptions: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                     level: 9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 }).then((resZip)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   const endTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   console.log('시작 시간 :', startTime.toLocaleString(), ', 종료 시간 :', endTime.toLocaleString(), ', 소요 시간 :', timeCheck(startTime, endTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   return res.json({success: 'S', data: resZip, name: zipName + '_' + year + '-' + month + '-' + date + '.zip'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 .catch((error)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   console.log(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                   return res.json({success: 'F', message:'파일 다운로드 중 오류가 발생하였습니다.', error: error}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             catch(err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               console.log(err); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//               return res.json({success: 'F', message:'파일 다운로드 중 오류가 발생하였습니다.', error: getErrorMessage(err)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//           return res.json({message:'다운로드 파일 정보를 확인 할 수 없습니다.', success:'F'}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//     catch(error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//       return res.json({success: 'F', message:'파일 다운로드 중 오류가 발생하였습니다.<br>'+ getErrorMessage(error)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/folderMove', async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (req.body) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1381,9 +1166,11 @@ async function getFolderItems(url, array, options, session) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  console.log('======================= folder check end ===============================') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  console.log('======================= folder check end ==============================='); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   console.log('folder check 소요시간 : ', timeCheck(folderCheckTime, new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  console.log('======================= delete label start ===============================') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  console.log('======================= delete label start ==============================='); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const fileDataArr = await Promise.all(fileArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const deleteLabelTime = new Date(); 
			 |