build/partitioninfo.js
function getLogicalPartitions(disk, index, offset, extendedPartitionOffset, limit) {
    return __awaiter(this, void 0, void 0, function* () {
        if (extendedPartitionOffset === undefined) {
            extendedPartitionOffset = offset;
        }
        if (limit === undefined) {
            limit = Infinity;
        }
        const result = [];
        if (limit <= 0) {
            return result;
        }
        const buf = yield readFromDisk(disk, offset, MBR_SIZE);
        for (const p of getPartitionsFromMBRBuf(buf)) {
            if (!p.extended) {
                result.push(mbrPartitionDict(p, offset, index));
            }
            else if (limit > 0) {
                const logicalPartitions = yield getLogicalPartitions(disk, index + 1, extendedPartitionOffset + p.byteOffset(), extendedPartitionOffset, limit - 1);
                result.push(...logicalPartitions);
                return result;
            }
        }
        return result;
    });
}
function getLogicalPartitions(disk, index, offset, extendedPartitionOffset, limit) {
    return __awaiter(this, void 0, void 0, function* () {
        if (extendedPartitionOffset === undefined) {
            extendedPartitionOffset = offset;
        }
        if (limit === undefined) {
            limit = Infinity;
        }
        const result = [];
        if (limit <= 0) {
            return result;
        }
        const buf = yield readFromDisk(disk, offset, MBR_SIZE);
        for (const p of getPartitionsFromMBRBuf(buf)) {
            if (!p.extended) {
                result.push(mbrPartitionDict(p, offset, index));
            }
            else if (limit > 0) {
                const logicalPartitions = yield getLogicalPartitions(disk, index + 1, extendedPartitionOffset + p.byteOffset(), extendedPartitionOffset, limit - 1);
                result.push(...logicalPartitions);
                return result;
            }
        }
        return result;
    });
}
function getLogicalPartitions ( disk , index , offset , extendedPartitionOffset , limit ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { if ( extendedPartitionOffset === undefined ) { extendedPartitionOffset = offset ; } if ( limit === undefined ) { limit = Infinity ; } const result = [ ] ; if ( limit <= 0 ) { return result ; } const buf = yield readFromDisk ( disk , offset , MBR_SIZE ) ; for ( const p of getPartitionsFromMBRBuf ( buf ) ) { if ( ! p . extended ) { result . push ( mbrPartitionDict ( p , offset , index ) ) ; } else if ( limit > 0 ) { const logicalPartitions = yield getLogicalPartitions ( disk , index + 1 , extendedPartitionOffset + p . byteOffset ( ) , extendedPartitionOffset , limit - 1 ) ; result . push ( ... logicalPartitions ) ; return result ; } } return result ; } ) ; }
Only for MBR
Only for MBR