Use `winget upgrade PACKAGE_NAME` within NodeJS `child_process.spawn()`

100 Views Asked by At

When running the command winget upgrade PACKAGE_NAME within NodeJS child_process.spawn(), the progress bar goes to stdout after the download is complete, not while it's downloading. How would I make it so I can detect every time progress has been made in downloading the file rather than after it's done downloading?

Current:

[
    'starting...',
    '\b \r\r  ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  17.0 MB / 79.4 MB\r  ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒  43.0 MB / 79.4 MB\r  ████████████████████████▒▒▒▒▒▒  64.0 MB / 79.4 MB\r  ██████████████████████████▒▒▒▒  70.0 MB / 79.4 MB\r  █████████████████████████████▒  77.0 MB / 79.4 MB\r  ██████████████████████████████  79.4 MB / 79.4 MB\r\n',
    'done!',
]

What I want:

[
    'starting...',
    '\b \r\r  ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  17.0 MB / 79.4 MB',
    '\r  ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒  43.0 MB / 79.4 MB',
    '\r  ████████████████████████▒▒▒▒▒▒  64.0 MB / 79.4 MB',
    '\r  ██████████████████████████▒▒▒▒  70.0 MB / 79.4 MB',
    '\r  █████████████████████████████▒  77.0 MB / 79.4 MB\r',
    '\r  ██████████████████████████████  79.4 MB / 79.4 MB\r\n',
    'done!',
]
0

There are 0 best solutions below