Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

将二进制流转base64无响应 #112

Open
askday opened this issue Nov 23, 2023 · 0 comments
Open

将二进制流转base64无响应 #112

askday opened this issue Nov 23, 2023 · 0 comments

Comments

@askday
Copy link

askday commented Nov 23, 2023

const res = await axios({
url,
method: 'GET',
headers: { Authorization: Bearer ${tenantToken} },
responseType: 'arraybuffer',
});

console.log(res);
try {
console.log('====0', res.data);
console.log(Buffer,Buffer.from);
const base64Data = Buffer.from(res.data, 'binary').toString('base64');
// console.log(base64Data);
console.log('====1');
return 'data:${image/jpeg};base64,' + base64Data;
} catch (err) {
console.log('====2');
console.log(err);
return null;
}
};

console.log(base64Data);这行打印不出来为什么呢

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant