tar
- Version 7.4.3
- Published
- 1.24 MB
- 6 dependencies
- ISC license
Install
npm i tar
yarn add tar
pnpm add tar
Overview
tar for node
Index
Variables
Functions
Classes
Pack
- [ADDFSENTRY]()
- [ADDTARENTRY]()
- [CURRENT]
- [ENDED]
- [ENTRY]()
- [ENTRYOPT]()
- [JOBDONE]()
- [JOBS]
- [ONDRAIN]()
- [ONREADDIR]()
- [ONSTAT]()
- [PIPE]()
- [PROCESS]()
- [PROCESSING]
- [PROCESSJOB]()
- [QUEUE]
- [READDIR]()
- [STAT]()
- [WRITE]()
- [WRITEENTRYCLASS]
- add()
- cwd
- end()
- file
- filter
- follow
- jobs
- linkCache
- maxReadSize
- mtime
- noDirRecurse
- noMtime
- noPax
- onWriteEntry
- opt
- pause()
- portable
- prefix
- preservePaths
- readdirCache
- statCache
- strict
- warn()
- write()
- zip
Parser
- [ABORTED]
- [BUFFER]
- [BUFFERCONCAT]()
- [CLOSESTREAM]()
- [CONSUMEBODY]()
- [CONSUMECHUNK]()
- [CONSUMECHUNKSUB]()
- [CONSUMEHEADER]()
- [CONSUMEMETA]()
- [CONSUMING]
- [EMIT]()
- [EMITMETA]()
- [EMITTEDEND]
- [ENDED]
- [EX]
- [GEX]
- [MAYBEEND]()
- [META]
- [NEXTENTRY]()
- [PROCESSENTRY]()
- [QUEUE]
- [READENTRY]
- [SAW_EOF]
- [SAW_NULL_BLOCK]
- [SAW_VALID_ENTRY]
- [STATE]
- [UNZIP]
- [WRITEENTRY]
- [WRITING]
- abort()
- brotli
- end()
- file
- filter
- maxMetaEntrySize
- readable
- strict
- warn()
- writable
- write()
Unpack
- [CHECKED_CWD]
- [CHECKFS]()
- [CHECKFS2]()
- [CHECKPATH]()
- [DIRECTORY]()
- [DOCHOWN]()
- [ENDED]
- [FILE]()
- [GID]()
- [HARDLINK]()
- [ISREUSABLE]()
- [LINK]()
- [MAKEFS]()
- [MAYBECLOSE]()
- [MKDIR]()
- [ONENTRY]()
- [ONERROR]()
- [PEND]()
- [PENDING]
- [PRUNECACHE]()
- [SKIP]()
- [SYMLINK]()
- [UID]()
- [UNPEND]()
- [UNSUPPORTED]()
- chmod
- cwd
- dirCache
- dmode
- fmode
- forceChown
- gid
- keep
- maxDepth
- newer
- noMtime
- preserveOwner
- preservePaths
- processGid
- processUid
- processUmask
- readable
- reservations
- setOwner
- strip
- transform
- uid
- umask
- unlink
- warn()
- win32
- writable
WriteEntry
- [AWAITDRAIN]()
- [CLOSE]()
- [DIRECTORY]()
- [FILE]()
- [HARDLINK]()
- [HEADER]()
- [LSTAT]()
- [MODE]()
- [ONDRAIN]()
- [ONLSTAT]()
- [ONOPENFILE]()
- [ONREAD]()
- [ONREADLINK]()
- [OPENFILE]()
- [PREFIX]()
- [PROCESS]()
- [READ]()
- [SYMLINK]()
- absolute
- blockLen
- blockRemain
- buf
- cwd
- emit()
- fd
- header
- length
- linkCache
- linkpath
- maxReadSize
- mtime
- myuid
- myuser
- noMtime
- noPax
- offset
- onWriteEntry
- path
- portable
- pos
- prefix
- preservePaths
- remain
- stat
- statCache
- strict
- type
- warn()
- win32
- write()
Interfaces
Type Aliases
Namespaces
Variables
variable c
const c: TarCommand<Pack, PackSync>;
variable create
const create: TarCommand<Pack, PackSync>;
variable extract
const extract: TarCommand<Unpack, UnpackSync>;
variable list
const list: TarCommand<Parser, Parser & { sync: true }>;
variable r
const r: TarCommand<never, never>;
variable replace
const replace: TarCommand<never, never>;
variable t
const t: TarCommand<Parser, Parser & { sync: true }>;
variable u
const u: TarCommand<never, never>;
variable update
const update: TarCommand<never, never>;
variable x
const x: TarCommand<Unpack, UnpackSync>;
Functions
function filesFilter
filesFilter: (opt: TarOptions, files: string[]) => void;
Classes
class Header
class Header implements HeaderData {}
constructor
constructor(data?: any, off?: number, ex?: HeaderData, gex?: HeaderData);
property atime
atime?: Date;
property block
block?: Buffer;
property charset
charset?: string;
property cksum
cksum?: number;
property cksumValid
cksumValid: boolean;
property comment
comment?: string;
property ctime
ctime?: Date;
property devmaj
devmaj: number;
property devmin
devmin: number;
property gid
gid?: number;
property gname
gname?: string;
property linkpath
linkpath?: string;
property mode
mode?: number;
property mtime
mtime?: Date;
property needPax
needPax: boolean;
property nullBlock
nullBlock: boolean;
property path
path?: string;
property size
size?: number;
property type
type: EntryTypeName;
property typeKey
readonly typeKey: EntryTypeCode | 'Unsupported';
property uid
uid?: number;
property uname
uname?: string;
method decode
decode: (buf: Buffer, off: number, ex?: HeaderData, gex?: HeaderData) => void;
method encode
encode: (buf?: Buffer, off?: number) => boolean;
class Pack
class Pack extends Minipass<Buffer, ReadEntry | string, WarnEvent<Buffer>> implements Warner {}
constructor
constructor(opt?: TarOptions);
property [CURRENT]
readonly [CURRENT]: PackJob;
property [ENDED]
[ENDED]: boolean;
property [JOBS]
[JOBS]: number;
property [PROCESSING]
[PROCESSING]: boolean;
property [QUEUE]
[QUEUE]: Yallist<PackJob>;
property [WRITEENTRYCLASS]
[WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync;
property cwd
cwd: string;
property file
file: string;
property filter
filter: (path: string, entry: any) => boolean;
property follow
follow: boolean;
property jobs
jobs: number;
property linkCache
linkCache: Map<`${number}:${number}`, string>;
property maxReadSize
maxReadSize?: number;
property mtime
mtime?: Date;
property noDirRecurse
noDirRecurse: boolean;
property noMtime
noMtime: boolean;
property noPax
noPax: boolean;
property onWriteEntry
onWriteEntry?: (entry: WriteEntry) => void;
property opt
opt: TarOptions;
property portable
portable: boolean;
property prefix
prefix: string;
property preservePaths
preservePaths: boolean;
property readdirCache
readdirCache: Map<string, string[]>;
property statCache
statCache: Map<string, Stats>;
property strict
strict: boolean;
property zip
zip?: any;
method [ADDFSENTRY]
[ADDFSENTRY]: (p: string) => void;
method [ADDTARENTRY]
[ADDTARENTRY]: (p: ReadEntry) => void;
method [ENTRY]
[ENTRY]: (job: PackJob) => WriteEntry | undefined;
method [ENTRYOPT]
[ENTRYOPT]: (job: PackJob) => TarOptions;
method [JOBDONE]
[JOBDONE]: (_job: PackJob) => void;
method [ONDRAIN]
[ONDRAIN]: () => void;
method [ONREADDIR]
[ONREADDIR]: (job: PackJob, entries: string[]) => void;
method [ONSTAT]
[ONSTAT]: (job: PackJob, stat: Stats) => void;
method [PIPE]
[PIPE]: (job: PackJob) => void;
method [PROCESS]
[PROCESS]: () => void;
method [PROCESSJOB]
[PROCESSJOB]: (job: PackJob) => void;
method [READDIR]
[READDIR]: (job: PackJob) => void;
method [STAT]
[STAT]: (job: PackJob) => void;
method [WRITE]
[WRITE]: (chunk: Buffer) => boolean;
method add
add: (path: string | ReadEntry) => this;
method end
end: { (cb?: () => void): this; (path: string | ReadEntry, cb?: () => void): this; ( path: string | ReadEntry, encoding?: Minipass.Encoding, cb?: () => void ): this;};
method pause
pause: () => void;
method warn
warn: (code: string, message: string | Error, data?: WarnData) => void;
method write
write: (path: string | ReadEntry) => boolean;
class PackJob
class PackJob {}
constructor
constructor(path: string, absolute: string);
property absolute
absolute: string;
property entry
entry?: WriteEntry | WriteEntryTar;
property ignore
ignore: boolean;
property path
path: string;
property pending
pending: boolean;
property piped
piped: boolean;
property readdir
readdir?: string[];
property stat
stat?: Stats;
class PackSync
class PackSync extends Pack {}
class Parser
class Parser extends EE implements Warner {}
constructor
constructor(opt?: TarOptions);
property [ABORTED]
[ABORTED]: boolean;
property [BUFFER]
[BUFFER]?: Buffer;
property [CONSUMING]
[CONSUMING]: boolean;
property [EMITTEDEND]
[EMITTEDEND]: boolean;
property [ENDED]
[ENDED]: boolean;
property [EX]
[EX]?: Pax;
property [GEX]
[GEX]?: Pax;
property [META]
[META]: string;
property [QUEUE]
[QUEUE]: Yallist<ReadEntry | [string | symbol, any, any]>;
property [READENTRY]
[READENTRY]?: ReadEntry;
property [SAW_EOF]
[SAW_EOF]: boolean;
property [SAW_NULL_BLOCK]
[SAW_NULL_BLOCK]: boolean;
property [SAW_VALID_ENTRY]
[SAW_VALID_ENTRY]?: boolean;
property [STATE]
[STATE]: State;
property [UNZIP]
[UNZIP]?: any;
property [WRITEENTRY]
[WRITEENTRY]?: ReadEntry;
property [WRITING]
[WRITING]: boolean;
property brotli
brotli?: any;
property file
file: string;
property filter
filter: (path: string, entry: any) => boolean;
property maxMetaEntrySize
maxMetaEntrySize: number;
property readable
readable: boolean;
property strict
strict: boolean;
property writable
writable: boolean;
method [BUFFERCONCAT]
[BUFFERCONCAT]: (c: Buffer) => void;
method [CLOSESTREAM]
[CLOSESTREAM]: () => void;
method [CONSUMEBODY]
[CONSUMEBODY]: (chunk: Buffer, position: number) => number;
method [CONSUMECHUNK]
[CONSUMECHUNK]: (chunk?: Buffer) => void;
method [CONSUMECHUNKSUB]
[CONSUMECHUNKSUB]: (chunk: Buffer) => void;
method [CONSUMEHEADER]
[CONSUMEHEADER]: (chunk: Buffer, position: number) => void;
method [CONSUMEMETA]
[CONSUMEMETA]: (chunk: Buffer, position: number) => number;
method [EMIT]
[EMIT]: (ev: string | symbol, data?: any, extra?: any) => void;
method [EMITMETA]
[EMITMETA]: (entry: ReadEntry) => void;
method [MAYBEEND]
[MAYBEEND]: () => void;
method [NEXTENTRY]
[NEXTENTRY]: () => void;
method [PROCESSENTRY]
[PROCESSENTRY]: (entry?: ReadEntry | [string | symbol, any, any]) => boolean;
method abort
abort: (error: Error) => void;
method end
end: { (cb?: () => void): this; (data: any, cb?: () => void): this; (str: string, encoding?: BufferEncoding, cb?: () => void): this;};
method warn
warn: (code: string, message: string | Error, data?: WarnData) => void;
method write
write: { (buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; ( str: string, encoding?: BufferEncoding, cb?: (err?: Error) => void ): boolean;};
class Pax
class Pax implements HeaderData {}
constructor
constructor(obj: HeaderData, global?: boolean);
property atime
atime?: Date;
property charset
charset?: string;
property comment
comment?: string;
property ctime
ctime?: Date;
property dev
dev?: number;
property gid
gid?: number;
property global
global: boolean;
property gname
gname?: string;
property ino
ino?: number;
property linkpath
linkpath?: string;
property mode
mode?: number;
property mtime
mtime?: Date;
property nlink
nlink?: number;
property path
path?: string;
property size
size?: number;
property uid
uid?: number;
property uname
uname?: string;
method encode
encode: () => Buffer;
method encodeBody
encodeBody: () => string;
method encodeField
encodeField: (field: keyof Pax) => string;
method parse
static parse: (str: string, ex?: HeaderData, g?: boolean) => Pax;
class ReadEntry
class ReadEntry extends Minipass<Buffer, Buffer> {}
constructor
constructor(header: Header, ex?: Pax, gex?: Pax);
property absolute
absolute?: string;
property atime
atime?: Date;
property blockRemain
blockRemain: number;
property ctime
ctime?: Date;
property dev
dev?: number;
property extended
extended?: Pax;
property gid
gid?: number;
property globalExtended
globalExtended?: Pax;
property gname
gname?: string;
property header
header: Header;
property ignore
ignore: boolean;
property ino
ino?: number;
property invalid
invalid: boolean;
property linkpath
linkpath?: string;
property meta
meta: boolean;
property mode
mode?: number;
property mtime
mtime?: Date;
property nlink
nlink?: number;
property path
path: string;
property remain
remain: number;
property size
size: number;
property startBlockSize
startBlockSize: number;
property type
type: EntryTypeName;
property uid
uid?: number;
property uname
uname?: string;
property unsupported
unsupported: boolean;
method write
write: (data: Buffer) => boolean;
class Unpack
class Unpack extends Parser {}
constructor
constructor(opt?: TarOptions);
property [CHECKED_CWD]
[CHECKED_CWD]: boolean;
property [ENDED]
[ENDED]: boolean;
property [PENDING]
[PENDING]: number;
property chmod
chmod: boolean;
property cwd
cwd: string;
property dirCache
dirCache: Map<string, boolean>;
property dmode
dmode: number;
property fmode
fmode: number;
property forceChown
forceChown: boolean;
property gid
gid?: number;
property keep
keep: boolean;
property maxDepth
maxDepth: number;
property newer
newer: boolean;
property noMtime
noMtime: boolean;
property preserveOwner
preserveOwner: boolean;
property preservePaths
preservePaths: boolean;
property processGid
processGid?: number;
property processUid
processUid?: number;
property processUmask
processUmask: number;
property readable
readable: boolean;
property reservations
reservations: PathReservations;
property setOwner
setOwner: boolean;
property strip
strip: number;
property transform
transform?: (entry: ReadEntry) => any;
property uid
uid?: number;
property umask
umask: number;
property unlink
unlink: boolean;
property win32
win32: boolean;
property writable
writable: boolean;
method [CHECKFS]
[CHECKFS]: (entry: ReadEntry) => void;
method [CHECKFS2]
[CHECKFS2]: (entry: ReadEntry, fullyDone: (er?: Error) => void) => void;
method [CHECKPATH]
[CHECKPATH]: (entry: ReadEntry) => boolean;
method [DIRECTORY]
[DIRECTORY]: (entry: ReadEntry, fullyDone: () => void) => void;
method [DOCHOWN]
[DOCHOWN]: (entry: ReadEntry) => boolean;
method [FILE]
[FILE]: (entry: ReadEntry, fullyDone: () => void) => void;
method [GID]
[GID]: (entry: ReadEntry) => number | undefined;
method [HARDLINK]
[HARDLINK]: (entry: ReadEntry, done: () => void) => void;
method [ISREUSABLE]
[ISREUSABLE]: (entry: ReadEntry, st: Stats) => boolean;
method [LINK]
[LINK]: ( entry: ReadEntry, linkpath: string, link: 'link' | 'symlink', done: () => void) => void;
method [MAKEFS]
[MAKEFS]: ( er: null | undefined | Error, entry: ReadEntry, done: () => void) => void;
method [MAYBECLOSE]
[MAYBECLOSE]: () => void;
method [MKDIR]
[MKDIR]: ( dir: string, mode: number, cb: (er?: null | MkdirError, made?: string) => void) => void;
method [ONENTRY]
[ONENTRY]: (entry: ReadEntry) => void;
method [ONERROR]
[ONERROR]: (er: Error, entry: ReadEntry) => void;
method [PEND]
[PEND]: () => void;
method [PRUNECACHE]
[PRUNECACHE]: (entry: ReadEntry) => void;
method [SKIP]
[SKIP]: (entry: ReadEntry) => void;
method [SYMLINK]
[SYMLINK]: (entry: ReadEntry, done: () => void) => void;
method [UID]
[UID]: (entry: ReadEntry) => number | undefined;
method [UNPEND]
[UNPEND]: () => void;
method [UNSUPPORTED]
[UNSUPPORTED]: (entry: ReadEntry) => void;
method warn
warn: (code: string, msg: string | Error, data?: WarnData) => void;
class UnpackSync
class UnpackSync extends Unpack {}
property sync
sync: boolean;
method [CHECKFS]
[CHECKFS]: (entry: ReadEntry) => void;
method [DIRECTORY]
[DIRECTORY]: (entry: ReadEntry, done: () => void) => void;
method [FILE]
[FILE]: (entry: ReadEntry, done: () => void) => void;
method [LINK]
[LINK]: ( entry: ReadEntry, linkpath: string, link: 'link' | 'symlink', done: () => void) => void;
method [MAKEFS]
[MAKEFS]: (er: null | Error | undefined, entry: ReadEntry) => void;
method [MKDIR]
[MKDIR]: (dir: string, mode: number) => unknown;
class WriteEntry
class WriteEntry extends Minipass<Buffer, Minipass.ContiguousData, WarnEvent> implements Warner {}
constructor
constructor(p: string, opt_?: TarOptionsWithAliases);
property absolute
absolute: string;
property blockLen
blockLen: number;
property blockRemain
blockRemain: number;
property buf
buf?: Buffer;
property cwd
cwd: string;
property fd
fd?: number;
property header
header?: Header;
property length
length: number;
property linkCache
linkCache: Map<`${number}:${number}`, string>;
property linkpath
linkpath?: string;
property maxReadSize
maxReadSize: number;
property mtime
mtime?: Date;
property myuid
myuid: number;
property myuser
myuser: string;
property noMtime
noMtime: boolean;
property noPax
noPax: boolean;
property offset
offset: number;
property onWriteEntry
onWriteEntry?: (entry: WriteEntry) => any;
property path
path: string;
property portable
portable: boolean;
property pos
pos: number;
property prefix
prefix?: string;
property preservePaths
preservePaths: boolean;
property remain
remain: number;
property stat
stat?: Stats;
property statCache
statCache: Map<string, Stats>;
property strict
strict: boolean;
property type
type?: EntryTypeName;
property win32
win32: boolean;
method [AWAITDRAIN]
[AWAITDRAIN]: (cb: () => any) => void;
method [CLOSE]
[CLOSE]: (cb?: (er?: null | Error | NodeJS.ErrnoException) => any) => void;
method [DIRECTORY]
[DIRECTORY]: () => void;
method [FILE]
[FILE]: () => void | this;
method [HARDLINK]
[HARDLINK]: (linkpath: string) => void;
method [HEADER]
[HEADER]: () => void;
method [LSTAT]
[LSTAT]: () => void;
method [MODE]
[MODE]: (mode: number) => number;
method [ONDRAIN]
[ONDRAIN]: () => void;
method [ONLSTAT]
[ONLSTAT]: (stat: Stats) => void;
method [ONOPENFILE]
[ONOPENFILE]: (fd: number) => void;
method [ONREAD]
[ONREAD]: (bytesRead: number) => void;
method [ONREADLINK]
[ONREADLINK]: (linkpath: string) => void;
method [OPENFILE]
[OPENFILE]: () => void;
method [PREFIX]
[PREFIX]: (path: string) => string;
method [PROCESS]
[PROCESS]: () => void | this;
method [READ]
[READ]: () => void;
method [SYMLINK]
[SYMLINK]: () => void;
method emit
emit: (ev: keyof WarnEvent, ...data: any[]) => boolean;
method warn
warn: (code: string, message: string | Error, data?: WarnData) => void;
method write
write: { (buffer: Buffer | string, cb?: () => void): boolean; (str: any, encoding?: any, cb?: () => void): boolean;};
class WriteEntrySync
class WriteEntrySync extends WriteEntry implements Warner {}
property sync
sync: boolean;
method [AWAITDRAIN]
[AWAITDRAIN]: (cb: () => any) => void;
method [CLOSE]
[CLOSE]: (cb?: (er?: null | Error | NodeJS.ErrnoException) => any) => void;
method [LSTAT]
[LSTAT]: () => void;
method [OPENFILE]
[OPENFILE]: () => void;
method [READ]
[READ]: () => void;
method [SYMLINK]
[SYMLINK]: () => void;
class WriteEntryTar
class WriteEntryTar extends Minipass<Buffer, Buffer | string, WarnEvent> implements Warner {}
constructor
constructor(readEntry: ReadEntry, opt_?: TarOptionsWithAliases);
property atime
atime?: Date;
property blockLen
blockLen: number;
property blockRemain
blockRemain: number;
property buf
buf: number;
property ctime
ctime?: Date;
property gid
gid?: number;
property gname
gname?: string;
property header
header?: Header;
property length
length: number;
property linkpath
linkpath?: string;
property mode
mode?: number;
property mtime
mtime?: Date;
property noMtime
noMtime: boolean;
property noPax
noPax: boolean;
property onWriteEntry
onWriteEntry?: (entry: WriteEntry) => any;
property path
path: string;
property portable
portable: boolean;
property pos
pos: number;
property prefix
prefix?: string;
property preservePaths
preservePaths: boolean;
property readEntry
readEntry: ReadEntry;
property remain
remain: number;
property size
size: number;
property strict
strict: boolean;
property type
type: EntryTypeName;
property uid
uid?: number;
property uname
uname?: string;
method [MODE]
[MODE]: (mode: number) => number;
method [PREFIX]
[PREFIX]: (path: string) => string;
method end
end: { (cb?: () => void): this; (chunk: any, cb?: () => void): this; (chunk: any, encoding?: BufferEncoding, cb?: () => void): this;};
method warn
warn: (code: string, message: string | Error, data?: WarnData) => void;
method write
write: { (buffer: Buffer | string, cb?: () => void): boolean; (str: any, encoding?: any, cb?: () => void): boolean;};
Interfaces
interface TarOptionsWithAliases
interface TarOptionsWithAliases extends TarOptions {}
property 'keep-existing'
'keep-existing'?: TarOptions['keep'];
When extracting, do not overwrite existing files at all.
property 'keep-newer-files'
'keep-newer-files'?: TarOptions['newer'];
When extracting, keep the existing file on disk if it's newer than the file in the archive.
property 'keep-newer'
'keep-newer'?: TarOptions['newer'];
When extracting, keep the existing file on disk if it's newer than the file in the archive.
property 'no-mtime'
'no-mtime'?: TarOptions['noMtime'];
When extracting, do not set the
mtime
value for extracted entries to match themtime
in the archive.When creating archives, do not store the
mtime
value in the entry. Note that this prevents properly using other mtime-based features (such astar.update
or thenewer
option) with the resulting archive.
property 'strip-components'
'strip-components'?: TarOptions['strip'];
When extracting, strip the specified number of path portions from the entry path. For example, with
{strip: 2}
, the entrya/b/c/d
would be extracted to{cwd}/c/d
.
property C
C?: TarOptions['cwd'];
The effective current working directory for this tar command
property f
f?: TarOptions['file'];
The tar file to be read and/or written. When this is set, a stream is not returned. Asynchronous commands will return a promise indicating when the operation is completed, and synchronous commands will return immediately.
property h
h?: TarOptions['follow'];
Pack the targets of symbolic links rather than the link itself.
property k
k?: TarOptions['keep'];
When extracting, do not overwrite existing files at all.
property keepExisting
keepExisting?: TarOptions['keep'];
When extracting, do not overwrite existing files at all.
property keepNewer
keepNewer?: TarOptions['newer'];
When extracting, keep the existing file on disk if it's newer than the file in the archive.
property keepNewerFiles
keepNewerFiles?: TarOptions['newer'];
When extracting, keep the existing file on disk if it's newer than the file in the archive.
property L
L?: TarOptions['follow'];
Pack the targets of symbolic links rather than the link itself.
property m
m?: TarOptions['noMtime'];
When extracting, do not set the
mtime
value for extracted entries to match themtime
in the archive.When creating archives, do not store the
mtime
value in the entry. Note that this prevents properly using other mtime-based features (such astar.update
or thenewer
option) with the resulting archive.
property noChmod
noChmod?: boolean;
Deprecated option. Set explicitly false to set
chmod: true
. Ignored if TarOptions#chmod is set to any boolean value.Deprecated
property p
p?: TarOptions['preserveOwner'];
When extracting, set the
uid
andgid
of extracted entries to theuid
andgid
fields in the archive. Defaults to true when run as root, and false otherwise.If false, then files and directories will be set with the owner and group of the user running the process. This is similar to
-p
intar(1)
, but ACLs and other system-specific data is never unpacked in this implementation, and modes are set by default already.
property P
P?: TarOptions['preservePaths'];
When creating archives, preserve absolute and
..
paths in the archive, rather than sanitizing them under the cwd.When extracting, allow absolute paths, paths containing
..
, and extracting through symbolic links. By default, the root/
is stripped from absolute paths (eg, turning/x/y/z
intox/y/z
), paths containing..
are not extracted, and any file whose location would be modified by a symbolic link is not extracted.**WARNING** This is almost always unsafe, and must NEVER be used on archives from untrusted sources, such as user input, and every entry must be validated to ensure it is safe to write. Even if the input is not malicious, mistakes can cause a lot of damage!
property stripComponents
stripComponents?: TarOptions['strip'];
When extracting, strip the specified number of path portions from the entry path. For example, with
{strip: 2}
, the entrya/b/c/d
would be extracted to{cwd}/c/d
.
property U
U?: TarOptions['unlink'];
When extracting, unlink files before creating them. Without this option, tar overwrites existing files, which preserves existing hardlinks. With this option, existing hardlinks will be broken, as will any symlink that would affect the location of an extracted file.
property z
z?: TarOptions['gzip'];
When creating a tar archive, this can be used to compress it as well. Set to
true
to use the default gzip options, or customize them as needed.When reading, if this is unset, then the compression status will be inferred from the archive data. This is generally best, unless you are sure of the compression settings in use to create the archive, and want to fail if the archive doesn't match expectations.
Type Aliases
type HeaderData
type HeaderData = { path?: string; mode?: number; uid?: number; gid?: number; size?: number; cksum?: number; type?: EntryTypeName | 'Unsupported'; linkpath?: string; uname?: string; gname?: string; devmaj?: number; devmin?: number; atime?: Date; ctime?: Date; mtime?: Date; charset?: string; comment?: string; dev?: number; ino?: number; nlink?: number;};
type State
type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body';
type TarOptionsWithAliasesAsync
type TarOptionsWithAliasesAsync = TarOptionsWithAliases & { sync?: false;};
type TarOptionsWithAliasesAsyncFile
type TarOptionsWithAliasesAsyncFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile;
type TarOptionsWithAliasesAsyncNoFile
type TarOptionsWithAliasesAsyncNoFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile;
type TarOptionsWithAliasesFile
type TarOptionsWithAliasesFile = | (TarOptionsWithAliases & { file: string; }) | (TarOptionsWithAliases & { f: string; });
type TarOptionsWithAliasesSync
type TarOptionsWithAliasesSync = TarOptionsWithAliases & { sync: true;};
type TarOptionsWithAliasesSyncFile
type TarOptionsWithAliasesSyncFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesFile;
type TarOptionsWithAliasesSyncNoFile
type TarOptionsWithAliasesSyncNoFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile;
Namespaces
namespace types
module 'dist/commonjs/types.d.ts' {}
variable code
const code: Map<EntryTypeName, EntryTypeCode>;
variable name
const name: Map<EntryTypeCode, EntryTypeName>;
function isCode
isCode: (c: string) => c is EntryTypeCode;
function isName
isName: (c: string) => c is EntryTypeName;
type EntryTypeCode
type EntryTypeCode = | '0' | '' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | 'g' | 'x' | 'A' | 'D' | 'I' | 'K' | 'L' | 'M' | 'N' | 'S' | 'V' | 'X';
type EntryTypeName
type EntryTypeName = | 'File' | 'OldFile' | 'Link' | 'SymbolicLink' | 'CharacterDevice' | 'BlockDevice' | 'Directory' | 'FIFO' | 'ContiguousFile' | 'GlobalExtendedHeader' | 'ExtendedHeader' | 'SolarisACL' | 'GNUDumpDir' | 'Inode' | 'NextFileHasLongLinkpath' | 'NextFileHasLongPath' | 'ContinuationFile' | 'OldGnuLongPath' | 'SparseFile' | 'TapeVolumeHeader' | 'OldExtendedHeader' | 'Unsupported';
Package Files (15)
- dist/commonjs/create.d.ts
- dist/commonjs/extract.d.ts
- dist/commonjs/header.d.ts
- dist/commonjs/index.d.ts
- dist/commonjs/list.d.ts
- dist/commonjs/options.d.ts
- dist/commonjs/pack.d.ts
- dist/commonjs/parse.d.ts
- dist/commonjs/pax.d.ts
- dist/commonjs/read-entry.d.ts
- dist/commonjs/replace.d.ts
- dist/commonjs/types.d.ts
- dist/commonjs/unpack.d.ts
- dist/commonjs/update.d.ts
- dist/commonjs/write-entry.d.ts
Dependencies (6)
Dev Dependencies (10)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/tar
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/tar)
- HTML<a href="https://www.jsdocs.io/package/tar"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6148 ms. - Missing or incorrect documentation? Open an issue for this package.