npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

browser-stream-tar

v3.0.3

Published

split tar web-stream into a sequence of Files

Downloads

571

Readme

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

browser-stream-tar

split tar web-stream into a sequence of Files

example

import { files } from "browser-stream-tar";

const response = await fetch("some tar file");
for await (const file of files(response.body)) {
  console.log(file.name);
  // do something with entry.stream()
}

API

Table of Contents

BLOCKSIZE

Field Name Byte Offset Length in Bytes Field Type name 0 100 NUL-terminated if NUL fits mode 100 8 uid 108 8 gid 116 8 size 124 12 mtime 136 12 chksum 148 8 typeflag 156 1 see below linkname 157 100 NUL-terminated if NUL fits magic 257 6 must be TMAGIC (NUL term.) version 263 2 must be TVERSION uname 265 32 NUL-terminated gname 297 32 NUL-terminated devmajor 329 8 devminor 337 8 prefix 345 155 NUL-terminated if NUL fits

Type: number

decodePaxHeader

Decodes a PAX header

Parameters

  • reader ReadableStreamReader where to read from
  • buffer Uint8Array
  • header Object to be filled with values form buffer

Returns Promise<Uint8Array> buffer positioned after the consumed bytes

decodeHeader

Decodes the next header.

Parameters

Returns Promise<(Uint8Array | undefined)> buffer positioned after the consumed bytes

files

Provide tar entry iterator.

Parameters

  • tar ReadableStream

Returns AsyncIterable<File>

enqueue

--512--|-----512------| | R | O | | DDDDDDDDDDDD---------HHHH | | | A0 A0 A1

buffer

+--------- size --------+ | +- remaining -+- overflow -+ | | | | HDD ... DDDDDDDDDDDDDDDDDD------------HHHHHH [BUFFER .... ] [BUFFER ... ] +----------- skip --------+

decodeString

Convert bytes into string.

Parameters

Returns string

decodeInteger

Convert ASCII octal number into number.

Parameters

Returns number

fill

Read bytes from a reader and append them to a given buffer until a requested length of the buffer is reached.

Parameters

  • reader ReadableStreamReader<Uint8Array> where to read from
  • buffer Uint8Array? initial buffer or undefined
  • length number? desired buffer length

Returns Promise<(Uint8Array | undefined)> filled up buffer

skip

Skip some bytes from a buffer.

Parameters

Returns Promise<(Uint8Array | undefined)> buffer positionend after skipped bytes

streamToUint8Array

Reads web stream content into a Uint8Array.

Parameters

  • stream ReadableStream

Returns Promise<Uint8Array>

install

With npm do:

npm install browser-stream-tar

license

BSD-2-Clause