background로 너무 긴 JSON을 보내려고 하니까 이 오류가 발생했다.
(고작 이정도로..)
{
"maskingColor":[{"r":0,"g":255,"b":0},{"r":127,"g":0,"b":255}],
"engravingColor":[{"r":0,"g":0,"b":0}],
"noMaskingColor":[{"r":255,"g":0,"b":0},{"r":255,"g":255,"b":0}]
}
해결은 보낼 때
JSON.stringify 로 json을 string으로 바꿔서 background.js로 보내면 된다.
background.js JSON.parse 해서 사용해야 한다.
front( getFile.vue)
reader.onload = async (event) => {
const colors = this.makeColorList4Send();
const fileContentBase64 = btoa(event.target.result);
this.isLoading = true;
ipcRenderer.send(
"convert-file",
fileContentBase64,
{
lineStrokeWidth: this.lineStrokeWidth,
circleStrokeWidth: this.circleStrokeWidth,
},
{
minX: this.viewBoxStartX,
minY: this.viewBoxStartY,
maxX: this.viewBoxStartX + this.viewBoxWidth,
maxY: this.viewBoxStartY + this.viewBoxHeight,
},
JSON.stringify(colors)
);
};
reader.readAsBinaryString(file);
},
background.js
config.colors = JSON.parse(colors);
'토막글' 카테고리의 다른 글
standard_init_linux.go:211 exec user process caused "no such file or directory" 에러 해결 (0) | 2024.01.30 |
---|---|
개발자 스타트업 인턴 후기 (현장실습) (0) | 2023.12.12 |
프로그래머스 레퍼런스 링크 (0) | 2023.04.29 |
[ionic angular] 데이터 바인딩 (1) | 2023.02.05 |
mac VS Code 단축키 (0) | 2023.02.05 |