@push.rocks/smartarchive 4.0.6 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,6 +80,7 @@ export class SmartArchive {
80
80
  streamFileStream.pipe(new plugins.smartstream.SmartDuplex({
81
81
  objectMode: true,
82
82
  writeFunction: async (chunkArg: plugins.smartfile.StreamFile, streamtools) => {
83
+ const done = plugins.smartpromise.defer<void>();
83
84
  console.log(chunkArg.relativeFilePath);
84
85
  const streamFile = chunkArg;
85
86
  const readStream = await streamFile.createReadStream();
@@ -88,6 +89,10 @@ export class SmartArchive {
88
89
  await plugins.smartfile.fs.ensureDir(plugins.path.dirname(writePath));
89
90
  const writeStream = plugins.smartfile.fsStream.createWriteStream(writePath);
90
91
  readStream.pipe(writeStream);
92
+ writeStream.on('finish', () => {
93
+ done.resolve();
94
+ })
95
+ await done.promise;
91
96
  },
92
97
  finalFunction: async () => {
93
98
  done.resolve();
@@ -117,7 +122,6 @@ export class SmartArchive {
117
122
  stream.on('end', function () {
118
123
  next(); // ready for next entry
119
124
  });
120
- stream.resume(); // just auto drain the stream
121
125
  }
122
126
  );
123
127
  tarStream.on('finish', function () {
@@ -138,7 +142,9 @@ export class SmartArchive {
138
142
  streamFileIntake.push(streamFile);
139
143
  streamFileIntake.signalEnd();
140
144
  }
141
- },
145
+ }, {
146
+ objectMode: true
147
+ }
142
148
  );
143
149
 
144
150
  archiveStream.pipe(createAnalyzedStream()).pipe(createUnpackStream());
package/ts/plugins.ts CHANGED
@@ -20,6 +20,5 @@ export { smartfile, smartpath, smartpromise, smartrequest, smartunique, smartstr
20
20
  import * as fileType from 'file-type';
21
21
  import * as fflate from 'fflate';
22
22
  import tarStream from 'tar-stream';
23
- import unbzip2Stream from 'unbzip2-stream';
24
23
 
25
- export { fileType, fflate, tarStream, unbzip2Stream };
24
+ export { fileType, fflate, tarStream };