Skip to content

Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped? #158

@catdevnull

Description

@catdevnull
    at Object.decode (/home/diablo/proy/fireactions/js/node_modules/.pnpm/tar-stream@3.1.4/node_modules/tar-stream/headers.js:116:43)
    at Extract._consumeHeader (/home/diablo/proy/fireactions/js/node_modules/.pnpm/tar-stream@3.1.4/node_modules/tar-stream/extract.js:144:30)
    at Extract._update (/home/diablo/proy/fireactions/js/node_modules/.pnpm/tar-stream@3.1.4/node_modules/tar-stream/extract.js:272:41)
    at Extract._write (/home/diablo/proy/fireactions/js/node_modules/.pnpm/tar-stream@3.1.4/node_modules/tar-stream/extract.js:287:10)
    at WritableState.update (/home/diablo/proy/fireactions/js/node_modules/.pnpm/streamx@2.15.0/node_modules/streamx/index.js:180:16)
    at WritableState.updateWriteNT (/home/diablo/proy/fireactions/js/node_modules/.pnpm/streamx@2.15.0/node_modules/streamx/index.js:532:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

repro:

import gunzip from "gunzip-maybe";
import { Duplex, Writable } from "node:stream";
import { extract } from "tar-stream";

const ex = extract();

ex.on("entry", (header, stream, next) => {
  console.debug(header.name);
  stream.on("end", function () {
    next(); // ready for next entry
  });

  stream.resume();
});
const res = await fetch("https://0x0.st/HQqY.bin");
const stream = res.body;
await stream.pipeThrough(Duplex.toWeb(gunzip())).pipeTo(Writable.toWeb(ex));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions