티스토리 뷰
유튜브라던지, vemoe 등등의 스트리밍되는 서비스에서 데이터를 받아와서 그 데이터를 영상의 형식으로 볼 수 있는데
데이터를 저장하는 양식과 공간이 필요한데 이때 사용되는게
B U F F E R
Buffer란?
- 파일을 읽어 들이는 방법 중 하나.
- 버퍼링은 파일을 준비하는 과정
- 이미지/영상을 송출 하기 위한 최소한의 데이터를 모아야 된다.
Buffer 작동방식
- Node.js에서는 파일을 사용하기 위한 공간을 마련한다.
- 메모리에 저장된 데이터가 Buffer가 된다.
- Node.js에서는 Buffer객체를 사용해 Buffer를 조작할 수 있다.
Buffer 기본 함수
1. alloc(): 빈배열생성
2. toString() : 바이트형태로 되어있는 버퍼를 문자로
3. from(): 문자열을 버퍼로 변경
Blob이란?
Binary Large Object의 줄임말이다. 직역 --> 이진수의 큰 객체
텍스트 혹은 이진 데이터를 담고있는 큰 객체
이미지, 비디오, 오디오등 다른 타입보다 데이터가 클수있는 것들은 담는 객체다.
blob의 주된 목적은 멀티 미디어를 저장하는데에 있다.
The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer. You cannot directly manipulate the contents of an ArrayBuffer; instead, you create one of the typed array objects or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer.
A Blob object represents a file-like object of immutable, raw data. Blob represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.