본문 바로가기
300x250

Web26

[Node.js] 파일 읽기 동기식 파일 IO는 파일 작업이 끝날 때까지 대기합니다. var file = require('fs'); var data = file.readFileSync('./package-lock.json', 'utf-8'); console.log(data); 비동기식 파일 IO는 파일 작업을 요청만 하고 바로 그 다음 작업을 수행합니다. 비동기식으로 파일을 읽는 것이 더 자주 사용되는 패턴 입니다. 비동기식으로 실행할 경우 파일을 읽은 것보다 console.log('package.json 파일을 읽도록 요청했습니다.'); 이 콘솔이 더 먼저 출력됩니다. var file = require('fs'); file.readFile('./package-lock.json', 'utf8', function(err, data){.. 2021. 1. 31.
[Node.js] 파일 경로 가져오기. path 모듈의 메소드 이용해서 파일 이름, 폴더 이름, 확장자를 가져올 수 있습니다. var path = require('path'); var fileName = "C:\\Users\\suris\\Downloads\\이슈사항.pptx"; var dirName = path.dirname(fileName); var baseName = path.basename(fileName); var extName = path.extname(fileName); console.log("디렉토리: %s, 파일이름: %s, 확장자: %s", dirName, baseName, extName); // 결과값 디렉토리: C:\Users\suris\Downloads, 파일이름: 이슈사항.pptx, 확장자: .pptx 2021. 1. 30.
DataTable 에서 SELECT 라벨 제거 SELECT 라벨 제거하려면 $(document).ready(function() { var table = $('#example').DataTable( { language: { search: ' ', } }); 와 같이 작성합니다. 2020. 12. 2.
Tomcat 에러 Could not delete ... May be locked by another process 발생 이유 - 빌드를 하고 난 다음 한개의 패키지명을 변경 하고 나서 다시 빌드를 하니 "Could not delete ... May be locked by another process" 와 같은 메시지가 출력되었음. 해결방안 - 서버탭에 있는 톰캣 서버에서 우클릭 --> Clean 클릭 - 서버탭에 있는 톰캣 서버에서 우클릭 --> Clean Tomcat Work Directory를 클릭 - 위 방법대로 안될 경우 C:\ --> 사용자 --> 내 아이디 폴더 --> eclipse-workspace --> .metadata --> .plugins --> org.eclipse.wst.server.core 폴더로 이동하여 tmp0 폴더를 삭제 한 후 위의 방법부터 다시 시작. 그리고 다시 실행하면 정상 동작 2020. 11. 9.
300x250