node.js - 如何使用nodejs将pdf数组缓冲区转换为pdf文件
问题描述
以下是 pdf 缓冲区。我想将缓冲区转换为 pdf 文件。
data = {
"file": {
"type": "Buffer",
"data": [
102,
24,
62
]
},
}
res.send( data );
解决方案
您可以使用res.sendFile并使用标头发送一些数据。
// res.sendFile(path [, options] [, fn])
let options = {
headers: {
'TheDataYouWantToSend': Date.now() // for example a timestamp
}
}
req.sendFile(absolutePathToFile, options)
我希望这有帮助
推荐阅读
- django - Django 聚合获取每个项目视图的用户数
- react-native - 如何在列表项中有条件地更改 rightIcon。我正在使用 react-native 元素
- .net - 如何针对 .Net Framework 和 Autofac 注册服务集合?
- c# - 数据从组合框到文本框不对应
- jquery - 应用程序脚本 - 删除谷歌文档中的特定表
- flutter - 如何在颤动中动态地将子级添加到列中
- sql - 如何在雪花中生成表和表列的统计信息?
- c++ - 如何在 gpu v100 上使用 fma?
- sql - 我看不到 QH_CLIENT_WORKSTATION_NAME 列,它为 Null。我正在查询连接在 Netezza 服务器上的 Aginity
- ios - UICollectionView 在当前项目上剩余的新项目插入