新的V1.0.2具有将附件上载到domino文档的新功能。我的上传代码是成功的,只要我使用的文件<= 48KB。只要我试图上传一个更大的文件,上传就会发生,在domino文档中我找到了一个大小合适的附件-但是文件已经损坏了!
以下是我的代码(对应于appdev pack文档中较大文件的示例代码):
for (var x = 0; x < files["tskFile"].length; x++) {
let sFilename = files["tskFile"][x].originalname;
let sPath = files["tskFile"][x].path;
let buffer = fs.readFileSync(sPath);
const writable = await db.bulkCreateAttachmentStream({});
writable.on('error', e => {
// An error occurred and the stream is closed
console.error("Error on write ", e)
});
writable.on('response', response => {
// The attachment content was written to the document and a
// response has arrived from the server
console.log(">> File " + sFilename + " saved to doc ")
});
let error;
// Write the image in n chunks
let offset = 0;
const writeRemaining = () => {
if (error) {
return;
}
let draining = true;
while (offset < buffer.length && draining) {
const remainingBytes = buffer.length - offset;
let chunkSize = 16 * 1024;
if (remainingBytes < chunkSize) {
chunkSize = remainingBytes;
}
const chunk = new Uint8Array(
buffer.slice(offset, offset + chunkSize),
);
draining = writable.write(chunk);
offset += chunkSize;
}
if (offset < buffer.length) {
// Buffer is not draining. Write some more once it drains.
writable.once('drain', writeRemaining);
} else {
writable.end();
}
};
writable.file({
unid: unid,
fileName: sFilename,
});
writeRemaining();
} // end forall attachments下面是我的服务器的notes.ini变量:
PROTON_MAX_WRITE_ATTACHMENT_MB=30,
PROTON_MAX_ATTACHMENT_CHUNK_KB=50,
PROTON_MIN_ATTACHMENT_CHUNK_KB=8是我的错误还是AppDevPack中的bug?有没有人尝试过这个新功能?
发布于 2019-10-01 03:54:16
我可以在64位Windows上用Proton重现类似的问题。在Linux上运行Proton时,我无法重现。我使用的客户端代码与您的不同,但我99%确定这是Proton中仅限Windows的错误。当我们有更多信息时,我们将更新此答案。同时,你能在Linux上试用Proton吗?
发布于 2019-10-08 22:34:22
我们已经找到了一个修复,它将包含在我们的下一个drop中。感谢您的这份报告!
https://stackoverflow.com/questions/58168707
复制相似问题