바이너리 데이터 버퍼 가져오기
n8n의 getBinaryDataBuffer() 함수를 사용해 워크플로에서 바이너리 데이터 버퍼에 접근하는 방법을 설명합니다.
바이너리 데이터 버퍼에는 워크플로에서 처리된 모든 바이너리 파일 데이터가 들어 있습니다. 다음과 같이 바이너리 데이터에 대한 작업을 수행하려면 버퍼에 접근해야 합니다. 데이터 조작: 예를 들어 CSV 파일에 열 헤더를 추가하는 경우. 계산에 데이터 사용: 예를 들어 데이터를 기반으로 해시 값을 계산하는 경우. 복잡한 HTTP 요청: 예를 들어 파일 업로드와 다른 데이터 형식 전송을 결합하는 경우. Note Python에서는 사용할 수 없음 getBinaryDataBuffer() 는 Python을 사용할 때는 지원되지 않습니다. n8n의 getBinaryDataBuffer() 함수를 사용하여 버퍼에 접근할 수 있습니다. /* * itemIndex: number. The index of the item in the input data. * binaryPropertyName: string. The name of the binary property. * The default in the Read/Write File From Disk node is 'data'. */ let binaryDataBufferItem = await this . helpers . getBinaryDataBuffer (itemIndex, binaryPropertyName); 예를 들면 다음과 같습니다. let binaryDataBufferItem = await this . helpers . getBinaryDataBuffer ( 0 , 'data' ); // Returns the data in the binary buffer for the first input item 항상 getBinaryDataBuffer() 함수를 사용해야 하며, items[0].binary.data.data 와 같은 표현식으로 버퍼를 직접 타깃팅하는 등의 이전 방식으로 버퍼에 직접 접근하는 방법은 피해야 합니다.