vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
    • Overview
    • link-tree
    • index
    • pool
    • Reference
    • store-entry
    • store-index
    • unpack
  • Type Aliases
  • FileEntry
  • Functions
  • checkFs()
  • storeLayout()
  • tmpName()
  • unpack()
  • unpackFileSync()
  • unpackSync()
  • unpackToStoreSync()
  1. Client
  2. /
  3. API Reference
  4. /
  5. @vltpkg/tar
  6. /
  7. unpack

unpack

Type Aliases

FileEntry

TypeScript
type FileEntry = object;

Defined in: unpack.ts:93

A file parsed out of a tarball, at its destination path.

Type declaration

NameTypeDescription
bodyBuffer-
dirfalse-
executablebooleanwritten with the exec bit: world-executable in the tar header
pathstring-

Functions

checkFs()

TypeScript
function checkFs(
   h, 
   tarDir, 
   target): h is { path: string }

Defined in: unpack.ts:201

Parameters

ParameterType
h{ path: string; }
h.path?string
tarDirundefined | string
targetstring

Returns

h is { path: string }


storeLayout()

TypeScript
function storeLayout(tarData, dir): object

Defined in: unpack.ts:508

What a gzipped or raw tarball explodes to in the global store at dir: its sidecar index, files and package.json bin target paths. Same parsing and path safety as unpackSync. No IO. Throws if the tarball has no valid package.json.

Parameters

ParameterType
tarDataBuffer
dirstring

Returns

object

NameType
binFilesstring[]
filesFileEntry[]
indexStoreIndex

tmpName()

TypeScript
function tmpName(target): string

Defined in: unpack.ts:270

Sibling temp path used to build target before renaming it in.

Parameters

ParameterType
targetstring

Returns

string


unpack()

TypeScript
function unpack(tarData, target): Promise<void>

Defined in: unpack.ts:238

Parameters

ParameterType
tarDataBuffer
targetstring

Returns

Promise<void>


unpackFileSync()

TypeScript
function unpackFileSync(
   file, 
   target, 
   offset): void

Defined in: unpack.ts:263

Unpack a tarball straight from a file on disk, skipping offset leading bytes. Used to extract from a cache entry in place, so the tarball never lands in the registry client's in-memory cache.

Parameters

ParameterTypeDefault value
filestringundefined
targetstringundefined
offsetnumber0

Returns

void


unpackSync()

TypeScript
function unpackSync(tarData, target): void

Defined in: unpack.ts:253

Same as unpack, but blocking. Faster: the async writers pay a libuv round trip per file, which costs more than the IO itself.

Parameters

ParameterType
tarDataBuffer
targetstring

Returns

void


unpackToStoreSync()

TypeScript
function unpackToStoreSync(tarData, dir): object

Defined in: unpack.ts:570

Explode a gzipped or raw tarball into dir for the global store and return its sidecar index (see storeLayout), written straight into dir (which must not exist; the caller renames it into place). Same modes as unpackSync followed by reify's bin chmod. Throws, writing nothing, without a valid package.json. Removes dir on failure.

Parameters

ParameterType
tarDataBuffer
dirstring

Returns

object

NameType
indexStoreIndex

Previousstore-indexNext@vltpkg/types

On this page

  • Type Aliases
  • FileEntry
  • Functions
  • checkFs()
  • storeLayout()
  • tmpName()
  • unpack()
  • unpackFileSync()
  • unpackSync()
  • unpackToStoreSync()

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now