You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the file size limit with accountingApi.updateInvoiceAttachmentByFileName() I am tyring to switch to using filesApi.uploadFile().
The example given in the documentation uses fs.createReadStream() to generate the body. This isn't possible to use when the file content is not stored in the file system, but is instead stored as a base64 string, but this is the same for updateInvoiceAttachmentByFileName(), which was overcome using the following:
Then it fails with an error TypeError: source.on is not a function
If I remove the options then the request is made but it returns a 400 status code with Bad Request.
As both the updateInvoiceAttachmentByFileName and uploadFile are expecting a read stream, and I am providing the same value generated from the same PDF file, shouldn't they both accept that field? If not, how else can the read stream be generated given that the fs.ReadStream can only be generated by createReadStream()?
I also tested running uploadFile using the same file from local using createReadStream() and the file uploaded but the filename field was not used on the uploaded file.
Thanks for your help
The text was updated successfully, but these errors were encountered:
Due to the file size limit with
accountingApi.updateInvoiceAttachmentByFileName()
I am tyring to switch to usingfilesApi.uploadFile()
.The example given in the documentation uses fs.createReadStream() to generate the body. This isn't possible to use when the file content is not stored in the file system, but is instead stored as a base64 string, but this is the same for
updateInvoiceAttachmentByFileName()
, which was overcome using the following:This has been working fine for a long time.
If I change the
updateInvoiceAttachmentByFileName()
line to be:Then it fails with an error
TypeError: source.on is not a function
If I remove the
options
then the request is made but it returns a400
status code withBad Request
.As both the
updateInvoiceAttachmentByFileName
anduploadFile
are expecting a read stream, and I am providing the same value generated from the same PDF file, shouldn't they both accept that field? If not, how else can the read stream be generated given that thefs.ReadStream
can only be generated bycreateReadStream()
?I also tested running
uploadFile
using the same file from local usingcreateReadStream()
and the file uploaded but thefilename
field was not used on the uploaded file.Thanks for your help
The text was updated successfully, but these errors were encountered: