mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 16:25:21 +00:00
Improved storage reading
This commit is contained in:
@@ -242,20 +242,14 @@ export const pass = functions.https.onRequest(
|
|||||||
await storageRef
|
await storageRef
|
||||||
.file(`thumbnails/${thumbnailFile}`)
|
.file(`thumbnails/${thumbnailFile}`)
|
||||||
.download({ destination: tempPath1 });
|
.download({ destination: tempPath1 });
|
||||||
|
|
||||||
|
const buffer = fs.readFileSync(tempPath1);
|
||||||
|
|
||||||
|
newPass.addBuffer("thumbnail.png", buffer);
|
||||||
|
newPass.addBuffer("thumbnail@2x.png", buffer);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
let buffer = Buffer.alloc(0);
|
|
||||||
|
|
||||||
try {
|
|
||||||
buffer = fs.readFileSync(tempPath1);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
newPass.addBuffer("thumbnail.png", buffer);
|
|
||||||
newPass.addBuffer("thumbnail@2x.png", buffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,19 +260,14 @@ export const pass = functions.https.onRequest(
|
|||||||
await storageRef
|
await storageRef
|
||||||
.file(`logos/${logoFile}`)
|
.file(`logos/${logoFile}`)
|
||||||
.download({ destination: tempPath2 });
|
.download({ destination: tempPath2 });
|
||||||
|
|
||||||
|
const buffer = fs.readFileSync(tempPath2);
|
||||||
|
|
||||||
|
newPass.addBuffer("logo.png", buffer);
|
||||||
|
newPass.addBuffer("logo@2x.png", buffer);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
let buffer = Buffer.alloc(0);
|
|
||||||
try {
|
|
||||||
buffer = fs.readFileSync(tempPath2);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
newPass.addBuffer("logo.png", buffer);
|
|
||||||
newPass.addBuffer("logo@2x.png", buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bufferData = newPass.getAsBuffer();
|
const bufferData = newPass.getAsBuffer();
|
||||||
|
|||||||
Reference in New Issue
Block a user