Skip to content

Commit 34fe82b

Browse files
committed
fix lint
1 parent dd45c6e commit 34fe82b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/storage.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function listStacFiles(): Promise<URL[]> {
4949
return _fileList;
5050
}
5151

52-
export function extractAndWritePackage(
52+
export async function extractAndWritePackage(
5353
stream: Readable,
5454
targetFileUri: URL,
5555
ht: HashTransform,
@@ -58,19 +58,20 @@ export function extractAndWritePackage(
5858
): Promise<void> {
5959
const unzipperParser: ParseStream = Parse();
6060

61-
return stream
61+
let writeProm: Promise<void> | undefined;
62+
63+
await stream
6264
.pipe(unzipperParser)
6365
.on('entry', (entry: Entry) => {
6466
log.debug({ datasetId, path: entry.path }, 'Export:Zip:File');
6567
if (entry.path.endsWith(PackageExtension)) {
6668
log.info({ datasetId, path: entry.path, target: targetFileUri.href }, 'Ingest:Read:Start');
6769
const gzipOut = entry.pipe(ht).pipe(createGzip({ level: 9 }));
68-
const writeProm = fsa.write(targetFileUri, gzipOut, {
70+
writeProm = fsa.write(targetFileUri, gzipOut, {
6971
contentType: 'application/geopackage+vnd.sqlite3',
7072
contentEncoding: 'gzip',
7173
});
72-
gzipOut.on('finish', async () => {
73-
await writeProm;
74+
gzipOut.on('finish', () => {
7475
unzipperParser.end();
7576
stream.destroy();
7677
});
@@ -79,6 +80,8 @@ export function extractAndWritePackage(
7980
}
8081
})
8182
.promise();
83+
84+
if (writeProm != null) await writeProm;
8285
}
8386

8487
/** Ingest the export into our cache */

0 commit comments

Comments
 (0)