Post not yet marked as solved
Post marked as unsolved with 0 replies, 121 views
try {
const fileName = await profileService.downloadVerifyIdentity(
req.user._id,
req.params.id,
);
if (fileName && fileName !== null) {
const filePath = path.join(__dirname, `/apple-passes/${fileName}`);
res.writeHead(200, {
'Content-type': 'application/vnd.apple.pkpass',
'Content-disposition': `attachment; filename=${fileName}`,
});
const stream = fs.createReadStream(filePath);
stream.pipe(res);
return new Promise((resolve) => {
fs.access(filePath, fs.constants.F_OK, (err) => {
err ? resolve(err) : resolve(fs.unlinkSync(filePath));
});
});
}
return 'Cannot download';
} catch (error) {
return res.bad(error);
}
On Safari in iOS, the pk pass can be downloaded and added to Wallet successfully.
On chrome and firefox, I can't download and don't get any errors message?
I try to find many ways to fix this, but I can't.
please send me a document or any resolved solution to fix this.
Thanks a lot.