智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/23/238d5e217342272f8c6d8bc3d9b...

13 lines
513 B

/**
* Add base64 tag, like data:image/img;base64
* @param responseData
*/
module.exports = function handleImgBase64Data(responseData) {
let headers = responseData.headers || {};
let contentType = (headers["content-type"] || headers["Content-Type"] || "")
.toString().toLowerCase();
if (contentType.indexOf("image") !== -1
&& responseData.responseText.indexOf("base64") === -1) {
responseData.responseText = `data:${contentType};base64,` + responseData.responseText;
}
}