File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
packages/excel-builder-vanilla/src Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,11 @@ export interface ExcelFileStreamOptions {
16
16
* Yields zipped chunks for browser (ReadableStream) or NodeJS (async generator).
17
17
*/
18
18
export function createExcelFileStream ( workbook : Workbook , options ?: ExcelFileStreamOptions ) {
19
- const isBrowser = typeof window ?. ReadableStream !== 'undefined' ;
20
- const isNode = typeof process ?. versions ?. node !== 'undefined' ;
21
- if ( isBrowser ) {
22
- return browserExcelStream ( workbook , options ) ;
19
+ if ( typeof window !== 'undefined' && typeof window . ReadableStream !== 'undefined' ) {
20
+ return browserExcelStream ( workbook , options ) ; // Browser environment
23
21
}
24
- if ( isNode ) {
25
- return nodeExcelStream ( workbook , options ) ;
22
+ if ( typeof process !== 'undefined' && process . versions ?. node ) {
23
+ return nodeExcelStream ( workbook , options ) ; // NodeJS environment
26
24
}
27
25
throw new Error ( 'Streaming is only supported in browser or NodeJS environments.' ) ;
28
26
}
You can’t perform that action at this time.
0 commit comments