@@ -5,9 +5,8 @@ import { fsa } from '@chunkd/fs';
55import { HashTransform } from '@chunkd/fs/build/src/hash.stream.js' ;
66import { FsAwsS3 } from '@chunkd/fs-aws' ;
77import type { LambdaRequest , LogType } from '@linzjs/lambda' ;
8- import { createWriteStream , rmSync } from 'fs' ;
8+ import { rmSync } from 'fs' ;
99import { Readable } from 'stream' ;
10- import { pipeline } from 'stream/promises' ;
1110import type { Entry } from 'yauzl' ;
1211import yauzl from 'yauzl' ;
1312
@@ -58,16 +57,16 @@ export async function extractAndWritePackage(
5857 datasetId : number ,
5958 log : LogType ,
6059) : Promise < void > {
61- const tmpZipFile = `/tmp/ ${ datasetId } .zip`;
60+ const tmpZipFile = new URL ( ` ${ datasetId } .zip`, '/tmp' ) ;
6261 try {
63- await pipeline ( stream , createWriteStream ( tmpZipFile ) ) ;
62+ await fsa . write ( tmpZipFile , stream ) ;
6463 const fileNames : string [ ] = [ ] ;
6564
6665 const writeProms : Promise < void > [ ] = [ ] ;
6766
6867 return new Promise ( ( resolve , reject ) => {
69- yauzl . open ( tmpZipFile , { lazyEntries : true } , ( err , zipFile ) => {
70- if ( err ) reject ( `Failed to open zip file ${ tmpZipFile } ` ) ;
68+ yauzl . open ( tmpZipFile . pathname , { lazyEntries : true } , ( err , zipFile ) => {
69+ if ( err ) reject ( `Failed to open zip file ${ tmpZipFile . pathname } ` ) ;
7170
7271 zipFile . once ( 'end' , ( ) => {
7372 Promise . all ( writeProms )
0 commit comments