unpack
Type Aliases
FileEntry
type FileEntry = object;Defined in: unpack.ts:93
A file parsed out of a tarball, at its destination path.
Type declaration
| Name | Type | Description |
|---|---|---|
body | Buffer | - |
dir | false | - |
executable | boolean | written with the exec bit: world-executable in the tar header |
path | string | - |
Functions
checkFs()
function checkFs(
h,
tarDir,
target): h is { path: string }Defined in: unpack.ts:201
Parameters
| Parameter | Type |
|---|---|
h | { path: string; } |
h.path? | string |
tarDir | undefined | string |
target | string |
Returns
h is { path: string }
storeLayout()
function storeLayout(tarData, dir): objectDefined 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
| Parameter | Type |
|---|---|
tarData | Buffer |
dir | string |
Returns
object
| Name | Type |
|---|---|
binFiles | string[] |
files | FileEntry[] |
index | StoreIndex |
tmpName()
function tmpName(target): stringDefined in: unpack.ts:270
Sibling temp path used to build target before renaming it in.
Parameters
| Parameter | Type |
|---|---|
target | string |
Returns
string
unpack()
function unpack(tarData, target): Promise<void>Defined in: unpack.ts:238
Parameters
| Parameter | Type |
|---|---|
tarData | Buffer |
target | string |
Returns
Promise<void>
unpackFileSync()
function unpackFileSync(
file,
target,
offset): voidDefined 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
| Parameter | Type | Default value |
|---|---|---|
file | string | undefined |
target | string | undefined |
offset | number | 0 |
Returns
void
unpackSync()
function unpackSync(tarData, target): voidDefined 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
| Parameter | Type |
|---|---|
tarData | Buffer |
target | string |
Returns
void
unpackToStoreSync()
function unpackToStoreSync(tarData, dir): objectDefined 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
| Parameter | Type |
|---|---|
tarData | Buffer |
dir | string |
Returns
object
| Name | Type |
|---|---|
index | StoreIndex |