This module lets you programmatically extract files from an rpm package.
Note: This module doesn't run
rpm install, nor it lets you do so programmatically.
This is a simple utility to extract files from an rpm package.
Why not use
rpm2cpio is CLI tool to extract RPM packages on *nix distributions.
Its an excellent and powerful tool to work in shell, but creating a script that works cross platform, is not so trivial.
Furthermore, there is no interaction with file system (other than initial reading of the rpm),
which makes this implementation faster than spawning child processes and doing file I/O.
$ npm install rpm-extract
const rpmExtract =
file object contains the metadata as well as contents of the file. It includes:
||File's contents, in a NodeJS buffer instance.|
||Unix file permissions or modes.|
||Last modification time|
||File path as was specified while creating the package.|
||Unix file type.|
||Symbolic Link name, if the file is a link.|
error object is an instance of standard Node JS Error
Currently, the module throws 2 known errors
Not a valid rpm.- if the file is not an rpm package
Only gzip compressed cpio archives are supported.- if the rpm was created from anything other than a
$ npm install $ npm test
This module only supports rpm files created with GZip compression, since
gzip is the most common format that works across different OS/platforms.
If you have a need for other compression formats such
bzip2 etc. create an issue or better, send a Pull Request.