node-modules / compressing

Everything you need for compressing and uncompressing
MIT License
431 stars 36 forks source link

TarStreamError: size mismatch #42

Closed munchkin09 closed 4 years ago

munchkin09 commented 4 years ago

Hello, im facing a problem with the method compressDir, i eventually getting this error when trying to compress a directory, but its not always. Lib version: 1.5.0 Code to execute:

compressing.tar.compressDir(inPath, outPath)
                        .then( () => {
                            return resolve(bundle)
                        }) 
                        .catch( error => {
                            console.log(error);
                            return reject(error)
                        })

Error output:

{ TarStreamError: size mismatch
 at Sink.<anonymous> (/centum/trace_network_api/node_modules/tar-stream/pack.js:175:23)
 at Sink.f (/centum/trace_network_api/node_modules/once/once.js:25:25)
 at Sink.onfinish (/centum/trace_network_api/node_modules/end-of-stream/index.js:31:27)
at emitNone (events.js:111:20)
at Sink.emit (events.js:208:7)
at finishMaybe (/centum/trace_network_api/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js:630:14)
 at endWritable (/centum/trace_network_api/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js:638:3)
at Sink.Writable.end (/centum/trace_network_api/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js:594:41)
at ReadStream.onend (_stream_readable.js:595:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at ReadStream.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9) name: 'TarStreamError' }

Any suggestions? I think i need some documentation to give the object options some data about my directory to compress, but i didnt find anything helpfull. Thanks in advance!

munchkin09 commented 4 years ago

My bad, its a problem in my code. Sorry for open that silly bug :s

854770857 commented 4 years ago

I have the same problem. How did you solve it

munchkin09 commented 4 years ago

The problem came when you try to compress a directory whit data still being copied inside, check if you have something doing a write in the directory before do the compression