\href{https://travis-ci.org/npm/node-tar}{\texttt{ }}

\href{./benchmarks}{\texttt{ Fast}} and full-\/featured Tar for Node.\+js

The API is designed to mimic the behavior of {\ttfamily tar(1)} on unix systems. If you are familiar with how tar works, most of this will hopefully be straightforward for you. If not, then hopefully this module can teach you useful unix skills that may come in handy someday \+:)\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20061}{}\doxysection{Background}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20061}
A \char`\"{}tar file\char`\"{} or \char`\"{}tarball\char`\"{} is an archive of file system entries (directories, files, links, etc.) The name comes from \char`\"{}tape archive\char`\"{}. If you run {\ttfamily man tar} on almost any Unix command line, you\textquotesingle{}ll learn quite a bit about what it can do, and its history.

Tar has 5 main top-\/level commands\+:


\begin{DoxyItemize}
\item {\ttfamily c} Create an archive
\item {\ttfamily r} Replace entries within an archive
\item {\ttfamily u} Update entries within an archive (ie, replace if they\textquotesingle{}re newer)
\item {\ttfamily t} List out the contents of an archive
\item {\ttfamily x} Extract an archive to disk
\end{DoxyItemize}

The other flags and options modify how this top level function works.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20062}{}\doxysection{High-\/\+Level API}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20062}
These 5 functions are the high-\/level API. All of them have a single-\/character name (for unix nerds familiar with {\ttfamily tar(1)}) as well as a long name (for everyone else).

All the high-\/level functions take the following arguments, all three of which are optional and may be omitted.


\begin{DoxyEnumerate}
\item {\ttfamily options} -\/ An optional object specifying various options
\item {\ttfamily paths} -\/ An array of paths to add or extract
\item {\ttfamily callback} -\/ Called when the command is completed, if async. (If sync or no file specified, providing a callback throws a {\ttfamily Type\+Error}.)
\end{DoxyEnumerate}

If the command is sync (ie, if {\ttfamily options.\+sync=true}), then the callback is not allowed, since the action will be completed immediately.

If a {\ttfamily file} argument is specified, and the command is async, then a {\ttfamily Promise} is returned. In this case, if async, a callback may be provided which is called when the command is completed.

If a {\ttfamily file} option is not specified, then a stream is returned. For {\ttfamily create}, this is a readable stream of the generated archive. For {\ttfamily list} and {\ttfamily extract} this is a writable stream that an archive should be written into. If a file is not specified, then a callback is not allowed, because you\textquotesingle{}re already getting a stream to work with.

{\ttfamily replace} and {\ttfamily update} only work on existing archives, and so require a {\ttfamily file} argument.

Sync commands without a file argument return a stream that acts on its input immediately in the same tick. For readable streams, this means that all of the data is immediately available by calling {\ttfamily stream.\+read()}. For writable streams, it will be acted upon as soon as it is provided, but this can be at any time.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20063}{}\doxysubsection{Warnings}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20063}
Some things cause tar to emit a warning, but should usually not cause the entire operation to fail. There are three ways to handle warnings\+:


\begin{DoxyEnumerate}
\item {\bfseries{Ignore them}} (default) Invalid entries won\textquotesingle{}t be put in the archive, and invalid entries won\textquotesingle{}t be unpacked. This is usually fine, but can hide failures that you might care about.
\item {\bfseries{Notice them}} Add an {\ttfamily onwarn} function to the options, or listen to the `\textquotesingle{}warn'{\ttfamily event on any tar stream. The function will get called as}onwarn(message, data){\ttfamily . Handle as appropriate.}
\item {\ttfamily $\ast$$\ast$\+Explode them.$\ast$$\ast$ Set}strict\+: true{\ttfamily in the options object, and }warn{\ttfamily messages will be emitted as}\textquotesingle{}error\textquotesingle{}{\ttfamily events instead. If there\textquotesingle{}s no}error\`{} handler, this causes the program to crash. If used with a promise-\/returning/callback-\/taking method, then it\textquotesingle{}ll send the error to the promise/callback.
\end{DoxyEnumerate}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20064}{}\doxysubsection{Examples}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20064}
The API mimics the {\ttfamily tar(1)} command line functionality, with aliases for more human-\/readable option and function names. The goal is that if you know how to use {\ttfamily tar(1)} in Unix, then you know how to use `require(\textquotesingle{}tar')\`{} in Java\+Script.

To replicate {\ttfamily tar czf my-\/tarball.\+tgz files and folders}, you\textquotesingle{}d do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{tar.c(}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    gzip: <true|gzip options>,}
\DoxyCodeLine{    file: 'my-\/tarball.tgz'}
\DoxyCodeLine{  \},}
\DoxyCodeLine{  ['some', 'files', 'and', 'folders']}
\DoxyCodeLine{).then(\_ => \{ .. tarball has been created .. \}) }

\end{DoxyCode}


To replicate {\ttfamily tar cz files and folders $>$ my-\/tarball.\+tgz}, you\textquotesingle{}d do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{tar.c( // or tar.create}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    gzip: <true|gzip options>}
\DoxyCodeLine{  \},}
\DoxyCodeLine{  ['some', 'files', 'and', 'folders']}
\DoxyCodeLine{).pipe(fs.createWriteStream('my-\/tarball.tgz')) }

\end{DoxyCode}


To replicate {\ttfamily tar xf my-\/tarball.\+tgz} you\textquotesingle{}d do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{tar.x(  // or tar.extract(}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    file: 'my-\/tarball.tgz'}
\DoxyCodeLine{  \}}
\DoxyCodeLine{).then(\_=> \{ .. tarball has been dumped in cwd .. \}) }

\end{DoxyCode}


To replicate {\ttfamily cat my-\/tarball.\+tgz $\vert$ tar x -\/C some-\/dir -\/-\/strip=1}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{fs.createReadStream('my-\/tarball.tgz').pipe(}
\DoxyCodeLine{  tar.x(\{}
\DoxyCodeLine{    strip: 1,}
\DoxyCodeLine{    C: 'some-\/dir' // alias for cwd:'some-\/dir', also ok}
\DoxyCodeLine{  \})}
\DoxyCodeLine{) }

\end{DoxyCode}


To replicate {\ttfamily tar tf my-\/tarball.\+tgz}, do this\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{tar.t(\{}
\DoxyCodeLine{  file: 'my-\/tarball.tgz',}
\DoxyCodeLine{  onentry: entry => \{ .. do whatever with it .. \}}
\DoxyCodeLine{\}) }

\end{DoxyCode}


To replicate {\ttfamily cat my-\/tarball.\+tgz $\vert$ tar t} do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{fs.createReadStream('my-\/tarball.tgz')}
\DoxyCodeLine{  .pipe(tar.t())}
\DoxyCodeLine{  .on('entry', entry => \{ .. do whatever with it .. \}) }

\end{DoxyCode}


To do anything synchronous, add {\ttfamily sync\+: true} to the options. Note that sync functions don\textquotesingle{}t take a callback and don\textquotesingle{}t return a promise. When the function returns, it\textquotesingle{}s already done. Sync methods without a file argument return a sync stream, which flushes immediately. But, of course, it still won\textquotesingle{}t be done until you {\ttfamily .end()} it.

To filter entries, add {\ttfamily filter\+: $<$function$>$} to the options. Tar-\/creating methods call the filter with {\ttfamily filter(path, stat)}. Tar-\/reading methods (including extraction) call the filter with {\ttfamily filter(path, entry)}. The filter is called in the {\ttfamily this}-\/context of the {\ttfamily Pack} or {\ttfamily Unpack} stream object.

The arguments list to {\ttfamily tar t} and {\ttfamily tar x} specify a list of filenames to extract or list, so they\textquotesingle{}re equivalent to a filter that tests if the file is in the list.

For those who {\itshape aren\textquotesingle{}t} fans of tar\textquotesingle{}s single-\/character command names\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{tar.c === tar.create}
\DoxyCodeLine{tar.r === tar.replace (appends to archive, file is required)}
\DoxyCodeLine{tar.u === tar.update (appends if newer, file is required)}
\DoxyCodeLine{tar.x === tar.extract}
\DoxyCodeLine{tar.t === tar.list }

\end{DoxyCode}


Keep reading for all the command descriptions and options, as well as the low-\/level API that they are built on.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20065}{}\doxysubsection{tar.\+c(options, file\+List, callback) \mbox{[}alias\+: tar.\+create\mbox{]}}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20065}
Create a tarball archive.

The {\ttfamily file\+List} is an array of paths to add to the tarball. Adding a directory also adds its children recursively.

An entry in {\ttfamily file\+List} that starts with an {\ttfamily @} symbol is a tar archive whose entries will be added. To add a file that starts with {\ttfamily @}, prepend it with {\ttfamily ./}.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily file} Write the tarball archive to the specified filename. If this is specified, then the callback will be fired when the file has been written, and a promise will be returned that resolves when the file is written. If a filename is not specified, then a Readable Stream will be returned which will emit the file data. \mbox{[}Alias\+: {\ttfamily f}\mbox{]}
\item {\ttfamily sync} Act synchronously. If this is set, then any provided file will be fully written after the call to {\ttfamily tar.\+c}. If this is set, and a file is not provided, then the resulting stream will already have the data ready to {\ttfamily read} or `emit(\textquotesingle{}data')\`{} as soon as you request it.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily cwd} The current working directory for creating the archive. Defaults to {\ttfamily process.\+cwd()}. \mbox{[}Alias\+: {\ttfamily C}\mbox{]}
\item {\ttfamily prefix} A path portion to prefix onto the entries in the archive.
\item {\ttfamily gzip} Set to any truthy value to create a gzipped archive, or an object with settings for {\ttfamily zlib.\+Gzip()} \mbox{[}Alias\+: {\ttfamily z}\mbox{]}
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, stat)} for each entry being added. Return {\ttfamily true} to add the entry to the archive, or {\ttfamily false} to omit it.
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths. \mbox{[}Alias\+: {\ttfamily P}\mbox{]}
\item {\ttfamily mode} The mode to set on the created file archive
\item {\ttfamily no\+Dir\+Recurse} Do not recursively archive the contents of directories. \mbox{[}Alias\+: {\ttfamily n}\mbox{]}
\item {\ttfamily follow} Set to true to pack the targets of symbolic links. Without this option, symbolic links are archived as such. \mbox{[}Alias\+: {\ttfamily L}, {\ttfamily h}\mbox{]}
\item {\ttfamily no\+Pax} Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive. \mbox{[}Alias\+: {\ttfamily m}, {\ttfamily no-\/mtime}\mbox{]}
\item {\ttfamily mtime} Set to a {\ttfamily Date} object to force a specific {\ttfamily mtime} for everything added to the archive. Overridden by {\ttfamily no\+Mtime}.
\end{DoxyItemize}

The following options are mostly internal, but can be modified in some advanced use cases, such as re-\/using caches between runs.


\begin{DoxyItemize}
\item {\ttfamily link\+Cache} A Map object containing the device and inode value for any file whose nlink is $>$ 1, to identify hard links.
\item {\ttfamily stat\+Cache} A Map object that caches calls {\ttfamily lstat}.
\item {\ttfamily readdir\+Cache} A Map object that caches calls to {\ttfamily readdir}.
\item {\ttfamily jobs} A number specifying how many concurrent jobs to run. Defaults to 4.
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 16 MB.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20066}{}\doxysubsection{tar.\+x(options, file\+List, callback) \mbox{[}alias\+: tar.\+extract\mbox{]}}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20066}
Extract a tarball archive.

The {\ttfamily file\+List} is an array of paths to extract from the tarball. If no paths are provided, then all the entries are extracted.

If the archive is gzipped, then tar will detect this and unzip it.

Note that all directories that are created will be forced to be writable, readable, and listable by their owner, to avoid cases where a directory prevents extraction of child entries by virtue of its mode.

Most extraction errors will cause a {\ttfamily warn} event to be emitted. If the {\ttfamily cwd} is missing, or not a directory, then the extraction will fail completely.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily cwd} Extract files relative to the specified directory. Defaults to {\ttfamily process.\+cwd()}. If provided, this must exist and must be a directory. \mbox{[}Alias\+: {\ttfamily C}\mbox{]}
\item {\ttfamily file} The archive file to extract. If not specified, then a Writable stream is returned where the archive data should be written. \mbox{[}Alias\+: {\ttfamily f}\mbox{]}
\item {\ttfamily sync} Create files and directories synchronously.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, entry)} for each entry being unpacked. Return {\ttfamily true} to unpack the entry from the archive, or {\ttfamily false} to skip it.
\item {\ttfamily newer} Set to true to keep the existing file on disk if it\textquotesingle{}s newer than the file in the archive. \mbox{[}Alias\+: {\ttfamily keep-\/newer}, {\ttfamily keep-\/newer-\/files}\mbox{]}
\item {\ttfamily keep} Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies. \mbox{[}Alias\+: {\ttfamily k}, {\ttfamily keep-\/existing}\mbox{]}
\item {\ttfamily preserve\+Paths} Allow absolute paths, paths containing {\ttfamily ..}, and extracting through symbolic links. By default, {\ttfamily /} is stripped from absolute paths, {\ttfamily ..} paths are not extracted, and any file whose location would be modified by a symbolic link is not extracted. \mbox{[}Alias\+: {\ttfamily P}\mbox{]}
\item {\ttfamily unlink} 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. \mbox{[}Alias\+: {\ttfamily U}\mbox{]}
\item {\ttfamily strip} Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after applying the filter, but before security checks. \mbox{[}Alias\+: {\ttfamily strip-\/components}, {\ttfamily strip\+Components}\mbox{]}
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily preserve\+Owner} If true, tar will set the {\ttfamily uid} and {\ttfamily gid} of extracted entries to the {\ttfamily uid} and {\ttfamily gid} fields in the archive. This 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 {\ttfamily -\/p} in {\ttfamily tar(1)}, but ACLs and other system-\/specific data is never unpacked in this implementation, and modes are set by default already. \mbox{[}Alias\+: {\ttfamily p}\mbox{]}
\item {\ttfamily uid} Set to a number to force ownership of all extracted files and folders, and all implicitly created directories, to be owned by the specified user id, regardless of the {\ttfamily uid} field in the archive. Cannot be used along with {\ttfamily preserve\+Owner}. Requires also setting a {\ttfamily gid} option.
\item {\ttfamily gid} Set to a number to force ownership of all extracted files and folders, and all implicitly created directories, to be owned by the specified group id, regardless of the {\ttfamily gid} field in the archive. Cannot be used along with {\ttfamily preserve\+Owner}. Requires also setting a {\ttfamily uid} option.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} value for extracted entries. \mbox{[}Alias\+: {\ttfamily m}, {\ttfamily no-\/mtime}\mbox{]}
\item {\ttfamily transform} Provide a function that takes an {\ttfamily entry} object, and returns a stream, or any falsey value. If a stream is provided, then that stream\textquotesingle{}s data will be written instead of the contents of the archive entry. If a falsey value is provided, then the entry is written to disk as normal. (To exclude items from extraction, use the {\ttfamily filter} option described above.)
\item {\ttfamily onentry} A function that gets called with {\ttfamily (entry)} for each entry that passes the filter.
\end{DoxyItemize}

The following options are mostly internal, but can be modified in some advanced use cases, such as re-\/using caches between runs.


\begin{DoxyItemize}
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 16 MB.
\item {\ttfamily umask} Filter the modes of entries like {\ttfamily process.\+umask()}.
\item {\ttfamily dmode} Default mode for directories
\item {\ttfamily fmode} Default mode for files
\item {\ttfamily dir\+Cache} A Map object of which directories exist.
\item {\ttfamily max\+Meta\+Entry\+Size} The maximum size of meta entries that is supported. Defaults to 1 MB.
\end{DoxyItemize}

Note that using an asynchronous stream type with the {\ttfamily transform} option will cause undefined behavior in sync extractions. \href{http://npm.im/minipass}{\texttt{ Mini\+Pass}}-\/based streams are designed for this use case.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20067}{}\doxysubsection{tar.\+t(options, file\+List, callback) \mbox{[}alias\+: tar.\+list\mbox{]}}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20067}
List the contents of a tarball archive.

The {\ttfamily file\+List} is an array of paths to list from the tarball. If no paths are provided, then all the entries are listed.

If the archive is gzipped, then tar will detect this and unzip it.

Returns an event emitter that emits {\ttfamily entry} events with {\ttfamily tar.\+Read\+Entry} objects. However, they don\textquotesingle{}t emit `\textquotesingle{}data'{\ttfamily or}\textquotesingle{}end\textquotesingle{}\`{} events. (If you want to get actual readable entries, use the {\ttfamily tar.\+Parse} class instead.)

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily cwd} Extract files relative to the specified directory. Defaults to {\ttfamily process.\+cwd()}. \mbox{[}Alias\+: {\ttfamily C}\mbox{]}
\item {\ttfamily file} The archive file to list. If not specified, then a Writable stream is returned where the archive data should be written. \mbox{[}Alias\+: {\ttfamily f}\mbox{]}
\item {\ttfamily sync} Read the specified file synchronously. (This has no effect when a file option isn\textquotesingle{}t specified, because entries are emitted as fast as they are parsed from the stream anyway.)
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, entry)} for each entry being listed. Return {\ttfamily true} to emit the entry from the archive, or {\ttfamily false} to skip it.
\item {\ttfamily onentry} A function that gets called with {\ttfamily (entry)} for each entry that passes the filter. This is important for when both {\ttfamily file} and {\ttfamily sync} are set, because it will be called synchronously.
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 16 MB.
\item {\ttfamily no\+Resume} By default, {\ttfamily entry} streams are resumed immediately after the call to {\ttfamily onentry}. Set {\ttfamily no\+Resume\+: true} to suppress this behavior. Note that by opting into this, the stream will never complete until the entry data is consumed.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20068}{}\doxysubsection{tar.\+u(options, file\+List, callback) \mbox{[}alias\+: tar.\+update\mbox{]}}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20068}
Add files to an archive if they are newer than the entry already in the tarball archive.

The {\ttfamily file\+List} is an array of paths to add to the tarball. Adding a directory also adds its children recursively.

An entry in {\ttfamily file\+List} that starts with an {\ttfamily @} symbol is a tar archive whose entries will be added. To add a file that starts with {\ttfamily @}, prepend it with {\ttfamily ./}.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily file} Required. Write the tarball archive to the specified filename. \mbox{[}Alias\+: {\ttfamily f}\mbox{]}
\item {\ttfamily sync} Act synchronously. If this is set, then any provided file will be fully written after the call to {\ttfamily tar.\+c}.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily cwd} The current working directory for adding entries to the archive. Defaults to {\ttfamily process.\+cwd()}. \mbox{[}Alias\+: {\ttfamily C}\mbox{]}
\item {\ttfamily prefix} A path portion to prefix onto the entries in the archive.
\item {\ttfamily gzip} Set to any truthy value to create a gzipped archive, or an object with settings for {\ttfamily zlib.\+Gzip()} \mbox{[}Alias\+: {\ttfamily z}\mbox{]}
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, stat)} for each entry being added. Return {\ttfamily true} to add the entry to the archive, or {\ttfamily false} to omit it.
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths. \mbox{[}Alias\+: {\ttfamily P}\mbox{]}
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 16 MB.
\item {\ttfamily no\+Dir\+Recurse} Do not recursively archive the contents of directories. \mbox{[}Alias\+: {\ttfamily n}\mbox{]}
\item {\ttfamily follow} Set to true to pack the targets of symbolic links. Without this option, symbolic links are archived as such. \mbox{[}Alias\+: {\ttfamily L}, {\ttfamily h}\mbox{]}
\item {\ttfamily no\+Pax} Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive. \mbox{[}Alias\+: {\ttfamily m}, {\ttfamily no-\/mtime}\mbox{]}
\item {\ttfamily mtime} Set to a {\ttfamily Date} object to force a specific {\ttfamily mtime} for everything added to the archive. Overridden by {\ttfamily no\+Mtime}.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20069}{}\doxysubsection{tar.\+r(options, file\+List, callback) \mbox{[}alias\+: tar.\+replace\mbox{]}}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20069}
Add files to an existing archive. Because later entries override earlier entries, this effectively replaces any existing entries.

The {\ttfamily file\+List} is an array of paths to add to the tarball. Adding a directory also adds its children recursively.

An entry in {\ttfamily file\+List} that starts with an {\ttfamily @} symbol is a tar archive whose entries will be added. To add a file that starts with {\ttfamily @}, prepend it with {\ttfamily ./}.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily file} Required. Write the tarball archive to the specified filename. \mbox{[}Alias\+: {\ttfamily f}\mbox{]}
\item {\ttfamily sync} Act synchronously. If this is set, then any provided file will be fully written after the call to {\ttfamily tar.\+c}.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily cwd} The current working directory for adding entries to the archive. Defaults to {\ttfamily process.\+cwd()}. \mbox{[}Alias\+: {\ttfamily C}\mbox{]}
\item {\ttfamily prefix} A path portion to prefix onto the entries in the archive.
\item {\ttfamily gzip} Set to any truthy value to create a gzipped archive, or an object with settings for {\ttfamily zlib.\+Gzip()} \mbox{[}Alias\+: {\ttfamily z}\mbox{]}
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, stat)} for each entry being added. Return {\ttfamily true} to add the entry to the archive, or {\ttfamily false} to omit it.
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths. \mbox{[}Alias\+: {\ttfamily P}\mbox{]}
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 16 MB.
\item {\ttfamily no\+Dir\+Recurse} Do not recursively archive the contents of directories. \mbox{[}Alias\+: {\ttfamily n}\mbox{]}
\item {\ttfamily follow} Set to true to pack the targets of symbolic links. Without this option, symbolic links are archived as such. \mbox{[}Alias\+: {\ttfamily L}, {\ttfamily h}\mbox{]}
\item {\ttfamily no\+Pax} Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive. \mbox{[}Alias\+: {\ttfamily m}, {\ttfamily no-\/mtime}\mbox{]}
\item {\ttfamily mtime} Set to a {\ttfamily Date} object to force a specific {\ttfamily mtime} for everything added to the archive. Overridden by {\ttfamily no\+Mtime}.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20070}{}\doxysection{Low-\/\+Level API}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20070}
\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20071}{}\doxysubsection{class tar.\+Pack}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20071}
A readable tar stream.

Has all the standard readable stream interface stuff. `\textquotesingle{}data'{\ttfamily and }\textquotesingle{}end\textquotesingle{}{\ttfamily events,}read(){\ttfamily method,}pause(){\ttfamily and}resume()\`{}, etc.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20072}{}\doxysubsubsection{constructor(options)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20072}
The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily cwd} The current working directory for creating the archive. Defaults to {\ttfamily process.\+cwd()}.
\item {\ttfamily prefix} A path portion to prefix onto the entries in the archive.
\item {\ttfamily gzip} Set to any truthy value to create a gzipped archive, or an object with settings for {\ttfamily zlib.\+Gzip()}
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, stat)} for each entry being added. Return {\ttfamily true} to add the entry to the archive, or {\ttfamily false} to omit it.
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths.
\item {\ttfamily link\+Cache} A Map object containing the device and inode value for any file whose nlink is $>$ 1, to identify hard links.
\item {\ttfamily stat\+Cache} A Map object that caches calls {\ttfamily lstat}.
\item {\ttfamily readdir\+Cache} A Map object that caches calls to {\ttfamily readdir}.
\item {\ttfamily jobs} A number specifying how many concurrent jobs to run. Defaults to 4.
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 16 MB.
\item {\ttfamily no\+Dir\+Recurse} Do not recursively archive the contents of directories.
\item {\ttfamily follow} Set to true to pack the targets of symbolic links. Without this option, symbolic links are archived as such.
\item {\ttfamily no\+Pax} Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive.
\item {\ttfamily mtime} Set to a {\ttfamily Date} object to force a specific {\ttfamily mtime} for everything added to the archive. Overridden by {\ttfamily no\+Mtime}.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20073}{}\doxysubsubsection{add(path)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20073}
Adds an entry to the archive. Returns the Pack stream.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20074}{}\doxysubsubsection{write(path)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20074}
Adds an entry to the archive. Returns true if flushed.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20075}{}\doxysubsubsection{end()}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20075}
Finishes the archive.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20076}{}\doxysubsection{class tar.\+Pack.\+Sync}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20076}
Synchronous version of {\ttfamily tar.\+Pack}.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20077}{}\doxysubsection{class tar.\+Unpack}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20077}
A writable stream that unpacks a tar archive onto the file system.

All the normal writable stream stuff is supported. {\ttfamily write()} and {\ttfamily end()} methods, `\textquotesingle{}drain'\`{} events, etc.

Note that all directories that are created will be forced to be writable, readable, and listable by their owner, to avoid cases where a directory prevents extraction of child entries by virtue of its mode.

`\textquotesingle{}close'\`{} is emitted when it\textquotesingle{}s done writing stuff to the file system.

Most unpack errors will cause a {\ttfamily warn} event to be emitted. If the {\ttfamily cwd} is missing, or not a directory, then an error will be emitted.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20078}{}\doxysubsubsection{constructor(options)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20078}

\begin{DoxyItemize}
\item {\ttfamily cwd} Extract files relative to the specified directory. Defaults to {\ttfamily process.\+cwd()}. If provided, this must exist and must be a directory.
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, entry)} for each entry being unpacked. Return {\ttfamily true} to unpack the entry from the archive, or {\ttfamily false} to skip it.
\item {\ttfamily newer} Set to true to keep the existing file on disk if it\textquotesingle{}s newer than the file in the archive.
\item {\ttfamily keep} Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies.
\item {\ttfamily preserve\+Paths} Allow absolute paths, paths containing {\ttfamily ..}, and extracting through symbolic links. By default, {\ttfamily /} is stripped from absolute paths, {\ttfamily ..} paths are not extracted, and any file whose location would be modified by a symbolic link is not extracted.
\item {\ttfamily unlink} 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.
\item {\ttfamily strip} Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after applying the filter, but before security checks.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily umask} Filter the modes of entries like {\ttfamily process.\+umask()}.
\item {\ttfamily dmode} Default mode for directories
\item {\ttfamily fmode} Default mode for files
\item {\ttfamily dir\+Cache} A Map object of which directories exist.
\item {\ttfamily max\+Meta\+Entry\+Size} The maximum size of meta entries that is supported. Defaults to 1 MB.
\item {\ttfamily preserve\+Owner} If true, tar will set the {\ttfamily uid} and {\ttfamily gid} of extracted entries to the {\ttfamily uid} and {\ttfamily gid} fields in the archive. This 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 {\ttfamily -\/p} in {\ttfamily tar(1)}, but ACLs and other system-\/specific data is never unpacked in this implementation, and modes are set by default already.
\item {\ttfamily win32} True if on a windows platform. Causes behavior where filenames containing {\ttfamily $<$$\vert$$>$?} chars are converted to windows-\/compatible values while being unpacked.
\item {\ttfamily uid} Set to a number to force ownership of all extracted files and folders, and all implicitly created directories, to be owned by the specified user id, regardless of the {\ttfamily uid} field in the archive. Cannot be used along with {\ttfamily preserve\+Owner}. Requires also setting a {\ttfamily gid} option.
\item {\ttfamily gid} Set to a number to force ownership of all extracted files and folders, and all implicitly created directories, to be owned by the specified group id, regardless of the {\ttfamily gid} field in the archive. Cannot be used along with {\ttfamily preserve\+Owner}. Requires also setting a {\ttfamily uid} option.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} value for extracted entries.
\item {\ttfamily transform} Provide a function that takes an {\ttfamily entry} object, and returns a stream, or any falsey value. If a stream is provided, then that stream\textquotesingle{}s data will be written instead of the contents of the archive entry. If a falsey value is provided, then the entry is written to disk as normal. (To exclude items from extraction, use the {\ttfamily filter} option described above.)
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily onentry} A function that gets called with {\ttfamily (entry)} for each entry that passes the filter.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20079}{}\doxysubsection{class tar.\+Unpack.\+Sync}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20079}
Synchronous version of {\ttfamily tar.\+Unpack}.

Note that using an asynchronous stream type with the {\ttfamily transform} option will cause undefined behavior in sync unpack streams. \href{http://npm.im/minipass}{\texttt{ Mini\+Pass}}-\/based streams are designed for this use case.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20080}{}\doxysubsection{class tar.\+Parse}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20080}
A writable stream that parses a tar archive stream. All the standard writable stream stuff is supported.

If the archive is gzipped, then tar will detect this and unzip it.

Emits `\textquotesingle{}entry'{\ttfamily events with}tar.\+Read\+Entry\`{} objects, which are themselves readable streams that you can pipe wherever.

Each {\ttfamily entry} will not emit until the one before it is flushed through, so make sure to either consume the data (with `on(\textquotesingle{}data', ...){\ttfamily or }.pipe(...){\ttfamily ) or throw it away with}.resume()\`{} to keep the stream flowing.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20081}{}\doxysubsubsection{constructor(options)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20081}
Returns an event emitter that emits {\ttfamily entry} events with {\ttfamily tar.\+Read\+Entry} objects.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily filter} A function that gets called with {\ttfamily (path, entry)} for each entry being listed. Return {\ttfamily true} to emit the entry from the archive, or {\ttfamily false} to skip it.
\item {\ttfamily onentry} A function that gets called with {\ttfamily (entry)} for each entry that passes the filter.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20082}{}\doxysubsubsection{abort(message, error)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20082}
Stop all parsing activities. This is called when there are zlib errors. It also emits a warning with the message and error provided.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20083}{}\doxysubsection{class tar.\+Read\+Entry extends $<$a href=\char`\"{}http\+://npm.\+im/minipass\char`\"{}$>$\+Mini\+Pass$<$/a$>$}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20083}
A representation of an entry that is being read out of a tar archive.

It has the following fields\+:


\begin{DoxyItemize}
\item {\ttfamily extended} The extended metadata object provided to the constructor.
\item {\ttfamily global\+Extended} The global extended metadata object provided to the constructor.
\item {\ttfamily remain} The number of bytes remaining to be written into the stream.
\item {\ttfamily block\+Remain} The number of 512-\/byte blocks remaining to be written into the stream.
\item {\ttfamily ignore} Whether this entry should be ignored.
\item {\ttfamily meta} True if this represents metadata about the next entry, false if it represents a filesystem object.
\item All the fields from the header, extended header, and global extended header are added to the Read\+Entry object. So it has {\ttfamily path}, {\ttfamily type}, {\ttfamily size,}mode\`{}, and so on.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20084}{}\doxysubsubsection{constructor(header, extended, global\+Extended)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20084}
Create a new Read\+Entry object with the specified header, extended header, and global extended header values.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20085}{}\doxysubsection{class tar.\+Write\+Entry extends $<$a href=\char`\"{}http\+://npm.\+im/minipass\char`\"{}$>$\+Mini\+Pass$<$/a$>$}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20085}
A representation of an entry that is being written from the file system into a tar archive.

Emits data for the Header, and for the Pax Extended Header if one is required, as well as any body data.

Creating a Write\+Entry for a directory does not also create Write\+Entry objects for all of the directory contents.

It has the following fields\+:


\begin{DoxyItemize}
\item {\ttfamily path} The path field that will be written to the archive. By default, this is also the path from the cwd to the file system object.
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily myuid} If supported, the uid of the user running the current process.
\item {\ttfamily myuser} The {\ttfamily env.\+USER} string if set, or `'\textquotesingle{}{\ttfamily . Set as the entry }uname{\ttfamily field if the file\textquotesingle{}s}uid{\ttfamily matches}this.\+myuid$<$tt$>$. -\/max\+Read\+Size{\ttfamily The maximum buffer size for}fs.\+read()\`{} operations. Defaults to 1 MB.
\item {\ttfamily link\+Cache} A Map object containing the device and inode value for any file whose nlink is $>$ 1, to identify hard links.
\item {\ttfamily stat\+Cache} A Map object that caches calls {\ttfamily lstat}.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths.
\item {\ttfamily cwd} The current working directory for creating the archive. Defaults to {\ttfamily process.\+cwd()}.
\item {\ttfamily absolute} The absolute path to the entry on the filesystem. By default, this is {\ttfamily path.\+resolve(this.\+cwd, this.\+path)}, but it can be overridden explicitly.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily win32} True if on a windows platform. Causes behavior where paths replace {\ttfamily \textbackslash{}} with {\ttfamily /} and filenames containing the windows-\/compatible forms of {\ttfamily $<$$\vert$$>$?\+:} characters are converted to actual {\ttfamily $<$$\vert$$>$?\+:} characters in the archive.
\item {\ttfamily no\+Pax} Suppress pax extended headers. Note that this means that long paths and linkpaths will be truncated, and large or negative numeric values may be interpreted incorrectly.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20086}{}\doxysubsubsection{constructor(path, options)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20086}
{\ttfamily path} is the path of the entry as it is written in the archive.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily max\+Read\+Size} The maximum buffer size for {\ttfamily fs.\+read()} operations. Defaults to 1 MB.
\item {\ttfamily link\+Cache} A Map object containing the device and inode value for any file whose nlink is $>$ 1, to identify hard links.
\item {\ttfamily stat\+Cache} A Map object that caches calls {\ttfamily lstat}.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths.
\item {\ttfamily cwd} The current working directory for creating the archive. Defaults to {\ttfamily process.\+cwd()}.
\item {\ttfamily absolute} The absolute path to the entry on the filesystem. By default, this is {\ttfamily path.\+resolve(this.\+cwd, this.\+path)}, but it can be overridden explicitly.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily win32} True if on a windows platform. Causes behavior where paths replace {\ttfamily \textbackslash{}} with {\ttfamily /}.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive.
\item {\ttfamily umask} Set to restrict the modes on the entries in the archive, somewhat like how umask works on file creation. Defaults to {\ttfamily process.\+umask()} on unix systems, or {\ttfamily 0o22} on Windows.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20087}{}\doxysubsubsection{warn(message, data)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20087}
If strict, emit an error with the provided message.

Othewise, emit a `\textquotesingle{}warn'\`{} event with the provided message and data.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20088}{}\doxysubsection{class tar.\+Write\+Entry.\+Sync}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20088}
Synchronous version of tar.\+Write\+Entry\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20089}{}\doxysubsection{class tar.\+Write\+Entry.\+Tar}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20089}
A version of tar.\+Write\+Entry that gets its data from a tar.\+Read\+Entry instead of from the filesystem.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20090}{}\doxysubsubsection{constructor(read\+Entry, options)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20090}
{\ttfamily read\+Entry} is the entry being read out of another archive.

The following options are supported\+:


\begin{DoxyItemize}
\item {\ttfamily portable} Omit metadata that is system-\/specific\+: {\ttfamily ctime}, {\ttfamily atime}, {\ttfamily uid}, {\ttfamily gid}, {\ttfamily uname}, {\ttfamily gname}, {\ttfamily dev}, {\ttfamily ino}, and {\ttfamily nlink}. Note that {\ttfamily mtime} is still included, because this is necessary other time-\/based operations.
\item {\ttfamily preserve\+Paths} Allow absolute paths. By default, {\ttfamily /} is stripped from absolute paths.
\item {\ttfamily strict} Treat warnings as crash-\/worthy errors. Default false.
\item {\ttfamily onwarn} A function that will get called with {\ttfamily (message, data)} for any warnings encountered.
\item {\ttfamily no\+Mtime} Set to true to omit writing {\ttfamily mtime} values for entries. Note that this prevents using other mtime-\/based features like {\ttfamily tar.\+update} or the {\ttfamily keep\+Newer} option with the resulting tar archive.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20091}{}\doxysubsection{class tar.\+Header}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20091}
A class for reading and writing header blocks.

It has the following fields\+:


\begin{DoxyItemize}
\item {\ttfamily null\+Block} True if decoding a block which is entirely composed of {\ttfamily 0x00} null bytes. (Useful because tar files are terminated by at least 2 null blocks.)
\item {\ttfamily cksum\+Valid} True if the checksum in the header is valid, false otherwise.
\item {\ttfamily need\+Pax} True if the values, as encoded, will require a Pax extended header.
\item {\ttfamily path} The path of the entry.
\item {\ttfamily mode} The 4 lowest-\/order octal digits of the file mode. That is, read/write/execute permissions for world, group, and owner, and the setuid, setgid, and sticky bits.
\item {\ttfamily uid} Numeric user id of the file owner
\item {\ttfamily gid} Numeric group id of the file owner
\item {\ttfamily size} Size of the file in bytes
\item {\ttfamily mtime} Modified time of the file
\item {\ttfamily cksum} The checksum of the header. This is generated by adding all the bytes of the header block, treating the checksum field itself as all ascii space characters (that is, {\ttfamily 0x20}).
\item {\ttfamily type} The human-\/readable name of the type of entry this represents, or the alphanumeric key if unknown.
\item {\ttfamily type\+Key} The alphanumeric key for the type of entry this header represents.
\item {\ttfamily linkpath} The target of Link and Symbolic\+Link entries.
\item {\ttfamily uname} Human-\/readable user name of the file owner
\item {\ttfamily gname} Human-\/readable group name of the file owner
\item {\ttfamily devmaj} The major portion of the device number. Always {\ttfamily 0} for files, directories, and links.
\item {\ttfamily devmin} The minor portion of the device number. Always {\ttfamily 0} for files, directories, and links.
\item {\ttfamily atime} File access time.
\item {\ttfamily ctime} File change time.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20092}{}\doxysubsubsection{constructor(data, \mbox{[}offset=0\mbox{]})}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20092}
{\ttfamily data} is optional. It is either a Buffer that should be interpreted as a tar Header starting at the specified offset and continuing for 512 bytes, or a data object of keys and values to set on the header object, and eventually encode as a tar Header.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20093}{}\doxysubsubsection{decode(block, offset)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20093}
Decode the provided buffer starting at the specified offset.

Buffer length must be greater than 512 bytes.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20094}{}\doxysubsubsection{set(data)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20094}
Set the fields in the data object.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20095}{}\doxysubsubsection{encode(buffer, offset)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20095}
Encode the header fields into the buffer at the specified offset.

Returns {\ttfamily this.\+need\+Pax} to indicate whether a Pax Extended Header is required to properly encode the specified data.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20096}{}\doxysubsection{class tar.\+Pax}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20096}
An object representing a set of key-\/value pairs in an Pax extended header entry.

It has the following fields. Where the same name is used, they have the same semantics as the tar.\+Header field of the same name.


\begin{DoxyItemize}
\item {\ttfamily global} True if this represents a global extended header, or false if it is for a single entry.
\item {\ttfamily atime}
\item {\ttfamily charset}
\item {\ttfamily comment}
\item {\ttfamily ctime}
\item {\ttfamily gid}
\item {\ttfamily gname}
\item {\ttfamily linkpath}
\item {\ttfamily mtime}
\item {\ttfamily path}
\item {\ttfamily size}
\item {\ttfamily uid}
\item {\ttfamily uname}
\item {\ttfamily dev}
\item {\ttfamily ino}
\item {\ttfamily nlink}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20097}{}\doxysubsubsection{constructor(object, global)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20097}
Set the fields set in the object. {\ttfamily global} is a boolean that defaults to false.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20098}{}\doxysubsubsection{encode()}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20098}
Return a Buffer containing the header and body for the Pax extended header entry, or {\ttfamily null} if there is nothing to encode.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20099}{}\doxysubsubsection{encode\+Body()}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20099}
Return a string representing the body of the pax extended header entry.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20100}{}\doxysubsubsection{encode\+Field(field\+Name)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20100}
Return a string representing the key/value encoding for the specified field\+Name, or `'\textquotesingle{}\`{} if the field is unset.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20101}{}\doxysubsection{tar.\+Pax.\+parse(string, extended, global)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20101}
Return a new Pax object created by parsing the contents of the string provided.

If the {\ttfamily extended} object is set, then also add the fields from that object. (This is necessary because multiple metadata entries can occur in sequence.)\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20102}{}\doxysubsection{tar.\+types}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20102}
A translation table for the {\ttfamily type} field in tar headers.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20103}{}\doxysubsubsection{tar.\+types.\+name.\+get(code)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20103}
Get the human-\/readable name for a given alphanumeric code.\hypertarget{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20104}{}\doxysubsubsection{tar.\+types.\+code.\+get(name)}\label{md_sfcode_node_modules_pacote_node_modules_tar_README_autotoc_md20104}
Get the alphanumeric code for a given human-\/readable name. 