我使用服务器端docusign包来允许我的客户签名和下载签名的文件。在客户完成签名后,我试图存储文档,但pdf是空白的。我的帐号正在制作中。知道为什么吗?
let dsApiClient = new docusign.ApiClient();//simple init
dsApiClient.setBasePath(args.basePath);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
let envelopesApi = new docusign.EnvelopesApi(dsApiClient),
results = await envelopesApi.getDocument(args.accountId, args.envelopeId, args.documentId, null);
fs.writeFile('test.pdf', data, 'utf8', (error_file) => {
console.log(file_name)
});//simple store binary to my hard drive
可以用流存储PDF
const stream = fs.createWriteStream(tempFilePath, { flags: 'a' });
stream.on('error', function(err: any) {
reject(tempFilePath);
});
stream.on('finish', function() {
resolve(tempFilePath);
});
stream.end(data, 'binary');