在node.js中使用pdfkit发送HTTP响应
我正在node.js express 3项目中使用pdfkit 0.6.1 我想将PDF作为HTTP响应发送,而不是保存在服务器上 上的示例说明如何使用:在node.js中使用pdfkit发送HTTP响应,node.js,pdfkit,Node.js,Pdfkit,我正在node.js express 3项目中使用pdfkit 0.6.1 我想将PDF作为HTTP响应发送,而不是保存在服务器上 上的示例说明如何使用: # HTTP response doc.pipe fs.createWriteStream(res) # add stuff to PDF here # finalize the PDF and end the stream doc.end() 然而,我得到了一个错误:“500 TypeError:path必须是字符串”如果我使用 d
# HTTP response
doc.pipe fs.createWriteStream(res)
# add stuff to PDF here
# finalize the PDF and end the stream
doc.end()
然而,我得到了一个错误:“500 TypeError:path必须是字符串”如果我使用
doc.pipe res
而不是
doc.pipe fs.createWriteStream(res)