fast-extract
Version:
Extract contents from various archive types (tar, tar.bz2, tar.gz, tar.xz, tgz, zip)
17 lines (16 loc) • 580 B
JavaScript
import getBasename from './basename.js';
import getSize from './size.js';
export default function sourceStats(source, options, endpoint, callback) {
if (typeof endpoint === 'function') {
callback = endpoint;
endpoint = null;
}
getSize(source, options, (err, size)=>{
if (err) return callback(err);
const stats = {};
const basename = getBasename(source, options, endpoint);
if (basename !== undefined) stats.basename = basename;
if (size !== undefined) stats.size = size;
callback(null, stats);
});
}