1
AngularJS에서 Swing으로 작성된 REST API에서 .bin 파일을 생성하려고합니다. 다음은 코드입니다. 여기
이미지 크기 (.bin)가 AJAX 호출을 통해 생성하는 동안 두 배로 증가했습니다.
var options = {
url: 'http://example.com/imageAPI',
method: 'POST',
headers: {
'Authentication': headerAndPostParams[0],
'Content-Type': 'application/json',
'Accept': 'application/octet-stream'
},
responseType: 'arraybuffer',
data: {
uniqueId: headerAndPostParams[1],
imageName: headerAndPostParams[2],
clientMacAddress: headerAndPostParams[3]
}
};
return $http(options).then(function(sucessResponse) {
if (sucessResponse.data != "" && sucessResponse.data.responseCode === undefined) {
download(sucessResponse.data, "image.bin", "application/octet-stream");
return true;
}
return false;
});
액세스 제어 - 허용 출처 : http://localhost:8080
내용 - 처리 : 첨부 파일, 파일 이름 =
콘텐츠 길이 cns3xxx_md_2.6.9_ac_aa_33_dd_aa_35.bin : 7864320
콘텐츠 유형 : application/octet-stream
날짜 : 1814 년 4 월 18 일 06:38:35 GMT
변경됨 : 원본
access-control-allow-credentials : true
위 코드는 정상적으로 작동합니다. 그러나 API에서 보낸 이미지의 크기는 7.5MB이고 UI면에서 생성 된 이미지 크기는 13.5입니다. MB. 거기에 우리가 그것을 donwload 기능을 부여하기 전에 수행 할 수있는 디코딩이있다.
(참고 : 다운로드는 donwload.js 라이브러리의 기능입니다.)