Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- jsreport
- node.js
- node red
- 파일타입
- jsreport 기초
- nodejs upgrade
- Redis 설치
- 파일속성
- javascript formdata
- postgres
- Node-RED
- nodered
- node red 기초
- InFluX
- 리눅스
- docker telegraf 설치
- nodejs 안정화버전
- redis
- 리눅스 node-red설치
- node red http
- telegraf 설치
- javascript파일깨짐
- nodejs 버전 업그레이드
- 도커 telegraf 설치
- 우분투
- nodejs update
- nodejs version
- node-red 기초
- 노드레드
- pubsub
Archives
- Today
- Total
♥일홍이 개발♥
[node.js] fileType 정리 본문
반응형
파일데이터 전송 > client에서 받을 때 자꾸 깨지는 현상 해결
1. 파일을 읽어서 데이터 넘겨줄때 파일 안깨지게 하는 방법! (예시)
let fileData =[]
content = fs.readFileSync(`${pdfData[0].file_path}`); //file_path -> 파일경로
base64 = Buffer.from(content, "binary").toString("base64");
fileData.push(base64);
res.writeHead(200, { Content: "application/pdf" }); //pdf 타입
res.res.write(JSON.stringify(fileData));
res.res.end();
2. MIME 타입 정리
확장자문서 종류MIME 타입
확장자 | 문서종류 | MIME 타입 |
.aac | AAC 오디오 파일 | audio/aac |
.abw | AbiWord 문서 | application/x-abiword |
.arc | 아카이브 문서 (인코딩된 다중 파일) | application/octet-stream |
.avi | AVI: Audio Video Interleave | video/x-msvideo |
.azw | 아마존 킨들 전자책 포맷 | application/vnd.amazon.ebook |
.bin | 모든 종류의 이진 데이터 | application/octet-stream |
.bz | BZip 아카이브 | application/x-bzip |
.bz2 | BZip2 아카이브 | application/x-bzip2 |
.csh | C-Shell 스크립트 | application/x-csh |
.css | Cascading Style Sheets (CSS) | text/css |
.csv | Comma-separated values (CSV) | text/csv |
.doc | Microsoft Word | application/msword |
.epub | Electronic publication (EPUB) | application/epub+zip |
.gif | Graphics Interchange Format (GIF) | image/gif |
.htm .html | HyperText Markup Language (HTML) | text/html |
.ico | Icon 포맷 | image/x-icon |
.ics | iCalendar 포맷 | text/calendar |
.jar | Java 아카이브 (JAR) | application/java-archive |
.jpeg .jpg | JPEG 이미지 | image/jpeg |
.js | JavaScript (ECMAScript) | text/javascript (Specifications: HTML and RFC 9239) |
.json | JSON 포맷 | application/json |
.mid .midi | Musical Instrument Digital Interface (MIDI) | audio/midi |
.mpeg | MPEG 비디오 | video/mpeg |
.mpkg | Apple Installer Package | application/vnd.apple.installer+xml |
.odp | OpenDocuemnt 프리젠테이션 문서 | application/vnd.oasis.opendocument.presentation |
.ods | OpenDocuemnt 스프레드시트 문서 | application/vnd.oasis.opendocument.spreadsheet |
.odt | OpenDocument 텍스트 문서 | application/vnd.oasis.opendocument.text |
.oga | OGG 오디오 | audio/ogg |
.ogv | OGG 비디오 | video/ogg |
.ogx | OGG | application/ogg |
Adobe Portable Document Format (PDF) | application/pdf | |
.ppt | Microsoft PowerPoint | application/vnd.ms-powerpoint |
.rar | RAR 아카이브 | application/x-rar-compressed |
.rtf | Rich Text Format (RTF) | application/rtf |
.sh | Bourne 쉘 스크립트 | application/x-sh |
.svg | Scalable Vector Graphics (SVG) | image/svg+xml |
.swf | Small web format (SWF) 혹은 Adobe Flash document | application/x-shockwave-flash |
.tar | Tape Archive (TAR) | application/x-tar |
.tif .tiff | Tagged Image File Format (TIFF) | image/tiff |
.ttf | TrueType Font | application/x-font-ttf |
.vsd | Microsft Visio | application/vnd.visio |
.wav | Waveform Audio Format | audio/x-wav |
.weba | WEBM 오디오 | audio/webm |
.webm | WEBM 비디오 | video/webm |
.webp | WEBP 이미지 | image/webp |
.woff | Web Open Font Format (WOFF) | application/x-font-woff |
.xhtml | XHTML | application/xhtml+xml |
.xls | Microsoft Excel | application/vnd.ms-excel |
.xml | XML | application/xml |
.xul | XUL | application/vnd.mozilla.xul+xml |
.zip | ZIP archive | application/zip |
.3gp | 3GPP 오디오/비디오 컨테이너 | video/3gpp audio/3gpp if it doesn't contain video |
.3g2 | 3GPP2 오디오/비디오 컨테이너 | video/3gpp2 audio/3gpp2 if it doesn't contain video |
.7z | 7-zip 아카이브 | application/x-7z-compressed |

참고페이지 - https://developer.mozilla.org/ko/
반응형
'Javascript > node.js' 카테고리의 다른 글
[node.js] Node.js 버전 업그레이드 (1) | 2024.01.22 |
---|---|
[node.js] multer 이미지 저장, 경로생성, 파일명 변경 (2) | 2022.05.26 |
[node.js] 파일 경로 directory 생성 (0) | 2022.05.26 |
Comments