unjs / nanotar

📼 Tiny and fast tar utils for any JavaScript runtime!
MIT License
125 stars 7 forks source link

Missing packed metadata and mtime in `createTar` #15

Closed ayuhito closed 2 months ago

ayuhito commented 2 months ago

Environment

Node 18 nanotar: 0.1.1

Reproduction


createTarGzip([ {
  name: 'file.txt',
  data: Buffer.from('Hello, world!'),
  attrs: {
    mode: 0o644,
    mtime: Date.now(),
  },
} ]).then((tar) => {
  fs.writeFile('file.tar.gz', tar);
})

Describe the bug

image

It doesn't seem like the packed metadata is being included, causing issues in file size reporting on Windows, and mtime for the files are not preserved since there is no way to pass that in.

Additional context

No response

Logs

No response

ayuhito commented 2 months ago

Invalid report. I noticed one is a tar while the other is tar+gzip.

ayuhito commented 2 months ago

Although it is interesting to note they have the same compression ratio. I wonder if this is actually a bug in tar-fs instead.