pass generate api stream is undefined
See original GitHub issueHi, I am getting undefined stream on using the following code. I dont see any error in my catch either. Please help as I am relatively new to this. The stream is undefined.
app.get('/downloadpass', async (req, res, next) => {
let examplePass = new Pass({
model: "./passModels/Coupon",
certificates: {
wwdr: "./certs/wwdr.pem",
signerCert: "./certs/signerCert.pem",
signerKey: {
keyFile: "./certs/passkey.pem",
passphrase: "12345"
}
},
overrides: {
// keys to be added or overridden
serialNumber: "AAGH44625236dddaffbda"
},
// if true, existing keys added through methods get overwritten
// pushed in queue otherwise.
shouldOverwrite: true
});
// Adding some settings to be written inside pass.json
examplePass.barcode("36478105430"); // Random value
// Generate the stream, which gets returned through a Promise
try {
let stream = await examplePass.generate();
stream.pipe(res)
} catch (e) {
//this will eventually be handled by your error handling middleware
console.log(e)
}
})
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (11 by maintainers)
Top Results From Across the Web
Javascript/stream Variable undefined - node.js - Stack Overflow
1 Answer 1 ... Stream event finish informs that operation is done, and passes no arguments. See https://nodejs.org/api/stream.html# ...
Read more >Stream | Node.js v19.3.0 Documentation
The node:stream module is useful for creating new types of stream instances. ... depends on the highWaterMark option passed into the stream's constructor....
Read more >Using readable streams - Web APIs | MDN
If the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined, done: true } ....
Read more >Streams—The definitive guide - web.dev
The Streams API allows JavaScript to programmatically access streams of data received over the network and process them as desired.
Read more >Streaming Files | NestJS - A progressive Node.js framework
A StreamableFile is a class that holds onto the stream that is to be returned. To create a new StreamableFile , you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for your work. =)
@nikhilenmudi if you see this commit, you can see that there was a throw that I, mistakenly, forgot to re-introduce when I moved to async/await.
Oh, awesome 😂. So both projects were not working for different reasons. 😂