feat(export): add buffer download methods to ExportBuilder
- Added download() method to get statements as Buffer without saving to disk - Added downloadAsArrayBuffer() method for web API compatibility - Enhanced documentation for getAccountStatement() method - Updated README with comprehensive examples - No breaking changes, backward compatible
This commit is contained in:
@@ -334,4 +334,24 @@ export class ExportBuilder {
|
||||
await bunqExport.waitForCompletion();
|
||||
await bunqExport.saveToFile(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and download export as Buffer
|
||||
*/
|
||||
public async download(): Promise<Buffer> {
|
||||
const bunqExport = await this.create();
|
||||
await bunqExport.waitForCompletion();
|
||||
return bunqExport.downloadContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and download export as ArrayBuffer
|
||||
*/
|
||||
public async downloadAsArrayBuffer(): Promise<ArrayBuffer> {
|
||||
const buffer = await this.download();
|
||||
return buffer.buffer.slice(
|
||||
buffer.byteOffset,
|
||||
buffer.byteOffset + buffer.byteLength
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user