@onereach/orest-input-cli
Version:
The tool for creating, serving, and publishing OREST Inputs
26 lines (22 loc) • 519 B
JavaScript
const path = require('path');
const tar = require('tar');
async function extractBundle({ filePath, relDirPath = '', destPath }) {
destPath = destPath ? destPath : path.resolve(process.cwd(), relDirPath);
return new Promise((resolve, reject) => {
tar.x(
{
file: filePath,
cwd: destPath,
strip: 1,
},
null,
error => {
if (error) {
return reject(error);
}
return resolve();
}
);
});
}
module.exports = extractBundle;