PHP 8.2.30
Preview: extract.js Size: 1.65 KB
/opt/alt/alt-nodejs22/root/usr/lib/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/extract.js

// tar -x
import * as fsm from '@isaacs/fs-minipass';
import fs from 'node:fs';
import { filesFilter } from './list.js';
import { makeCommand } from './make-command.js';
import { Unpack, UnpackSync } from './unpack.js';
const extractFileSync = (opt) => {
    const u = new UnpackSync(opt);
    const file = opt.file;
    const stat = fs.statSync(file);
    // This trades a zero-byte read() syscall for a stat
    // However, it will usually result in less memory allocation
    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    const stream = new fsm.ReadStreamSync(file, {
        readSize: readSize,
        size: stat.size,
    });
    stream.pipe(u);
};
const extractFile = (opt, _) => {
    const u = new Unpack(opt);
    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    const file = opt.file;
    const p = new Promise((resolve, reject) => {
        u.on('error', reject);
        u.on('close', resolve);
        // This trades a zero-byte read() syscall for a stat
        // However, it will usually result in less memory allocation
        fs.stat(file, (er, stat) => {
            if (er) {
                reject(er);
            }
            else {
                const stream = new fsm.ReadStream(file, {
                    readSize: readSize,
                    size: stat.size,
                });
                stream.on('error', reject);
                stream.pipe(u);
            }
        });
    });
    return p;
};
export const extract = makeCommand(extractFileSync, extractFile, opt => new UnpackSync(opt), opt => new Unpack(opt), (opt, files) => {
    if (files?.length)
        filesFilter(opt, files);
});
//# sourceMappingURL=extract.js.map

Directory Contents

Dirs: 0 × Files: 30

Name Size Perms Modified Actions
2.11 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
310 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1.65 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1018 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
10.36 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
647 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
2.52 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
3.16 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1.83 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
6.30 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
753 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
489 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
490 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1.60 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
12.70 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
23 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
21.23 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
5.33 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
4.64 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
4.08 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
7.01 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1.04 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
489 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
390 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1.25 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
31.68 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1006 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
795 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
549 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
22.25 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).