mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
parent
1bb724fe0e
commit
1812587970
@ -30,8 +30,12 @@ const tarExtract = async (options: TarExtractOptions) => {
|
|||||||
throw new Error(`Extracting ${outPath} would overwrite`);
|
throw new Error(`Extracting ${outPath} would overwrite`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move to the next item when all available data has been read.
|
// Allows moving to the next item after all data for this entry has been read
|
||||||
stream.once('end', () => next());
|
// **and** this data has been processed.
|
||||||
|
// See https://github.com/laurent22/joplin/issues/10285
|
||||||
|
const streamEndPromise = new Promise<void>((resolve) => {
|
||||||
|
stream.once('end', () => resolve());
|
||||||
|
});
|
||||||
|
|
||||||
if (header.type === 'directory') {
|
if (header.type === 'directory') {
|
||||||
await fsDriver.mkdir(outPath);
|
await fsDriver.mkdir(outPath);
|
||||||
@ -46,7 +50,8 @@ const tarExtract = async (options: TarExtractOptions) => {
|
|||||||
|
|
||||||
// Drain the rest of the stream.
|
// Drain the rest of the stream.
|
||||||
stream.resume();
|
stream.resume();
|
||||||
|
await streamEndPromise;
|
||||||
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
let finished = false;
|
let finished = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user