Closed pietrzakadrian closed 3 years ago
Okay, I solved it and thanks to you I found out more about Observable:)
public async generateInvoice(invoice: InvoiceDto): Promise<any> {
return this._pdfService
.toBuffer('invoice', { locals: { invoice } })
.subscribe(
(file) => {
this._fileService.uploadDocumentFile(file, invoice);
},
(error) => {
throw new GenerateInvoiceInvalidException(error);
},
);
}
However, this is not the best solution for me. How else can I get just Buffer?
Hi @pietrzakadrian , you should probably try using this:
public async generateInvoice(invoice: InvoiceDto): Promise<any> {
const file = await this._pdfService
.toBuffer('invoice', { locals: { invoice } })
.toPromise();
this._fileService.uploadDocumentFile(file, invoice);
}
You can read more about it here.
I am using the latest version of your package. I'm trying to upload the generated buffer to my aws cloud. it looks like this:
Error:
InvalidParameterType: Expected params.Body to be a string, Buffer, Stream, Blob, or typed array object
How do I do that? I don't have much experience with RxJs