Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browser-stream-tar

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-stream-tar

split tar web-stream into a sequence of Files

  • 3.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
56
decreased by-52.14%
Maintainers
0
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc