8000 GitHub - xtuc/trotar: A performant tar parser with streaming support
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
10000 / trotar Public

A performant tar parser with streaming support

Notifications You must be signed in to change notification settings

xtuc/trotar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trotar

A performant tar parser with streaming support

Usage

import { USTarParser } from "trotar"
const parser = new USTarParser;

parser.on("file",
5B63
 (name, content) => {
  console.log("file", name, "has", content);
});

await parser.parse(tar);

With streaming:

import { StreamingUSTarParser } from "trotar"

const parser = new StreamingUSTarParser

parser.on("file", (name, content) => {
  console.log("file", name, "has", content);
})

const res = await fetch("https://registry.npmjs.org/hi-sven/-/hi-sven-1.29.0.tgz")

const writableStream = new WritableStream(
  {
    async write(chunk) {
      parser.write(chunk);
    },

    close() { console.log("closed"); },
    abort(err) { console.error("Sink error:", err); },
  },
);

const ds = new DecompressionStream('gzip')

res.body.pipeThrough(ds).pipeTo(writableStream)

About

A performant tar parser with streaming support

Resources

Stars

Watchers

Forks

0