UNPKG

dismjs

Version:

A NPM module to manipulate the "Deployment Image Servicing and Management" tool.

24 lines (21 loc) 773 B
const DISM = require('dismjs'); const child_process = require('child_process'); const execute = (command, encoding = 'utf8') => { return new Promise((resolve) => { const return_data = (err, stdout, stderr) => { resolve({err: err, stdout: stdout, stderr: stderr}); } child_process.exec(command, { encoding: encoding }, return_data); }); } async function main(){ let dism = new DISM(execute); if (await dism.isAdmin()){ console.info('dismjs is in administrator mode.'); let info = await dism.getWimInfo('C:\\Users\\PC\\Desktop\\Programmation\\WindowsPE\\boot.wim', 1); console.log(info); } else { console.error('dismjs is not ran in administrator mode. It is therefore unable to use DISM.'); } } main();