Skip to content

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

@askday

Description

@askday

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);这行打印不出来为什么呢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions