cpio-fs
filesystem bindings for cpio-stream based on tar-fs
npm install cpio-fs
Usage
cpio-fs allows you to pack directories into cpio archives and extract cpios into directories.
var cpio =var fs =// packing a directorycpio// extracting a directoryfs
To ignore various files when packing or extracting add a ignore function to the options. ignore
is also an alias for filter
.
var pack = cpiovar extract = cpio
You can also specify which entries to pack using the entries
option
var pack = cpio
If you want to modify the headers when packing/extracting add a map function to the options
var pack = cpiovar extract = cpio
Similarly you can use mapStream
incase you wanna modify the input/output file streams
var pack = cpiovar extract = cpio
Set options.fmode
and options.dmode
to ensure that files/directories extracted have the corresponding modes
var extract = cpio
It can be useful to use dmode
and fmode
if you are packing/unpacking cpios between *nix/windows to ensure that all files/directories unpacked are readable.
Set options.strict
to false
if you want to ignore errors due to unsupported entry types (like device files)
To dereference symlinks (pack the contents of the symlink instead of the link itself) set options.dereference
to true
.
Copy a directory
Copying a directory with permissions and mtime intact is as simple as
cpio
License
MIT