You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
696 B
JavaScript

'use strict';
const Promise = require("bluebird");
const parsePathTable = require("../parse/path-table");
module.exports = function readPathTable(image) {
return Promise.try(() => {
return image.getPrimaryVolumeDescriptor();
}).then((primaryVolumeDescriptor) => {
return Promise.try(() => {
let start = primaryVolumeDescriptor.data.pathTableLocationL * primaryVolumeDescriptor.data.sectorSize;
let end = start + primaryVolumeDescriptor.data.pathTableSize - 1;
return image.readRange(start, end);
}).then((buffer) => {
return parsePathTable(buffer, primaryVolumeDescriptor.data.sectorSize);
});
});
}