0

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!',
]
K.K Designs
  • 688
  • 1
  • 6
  • 22
  • Try [`{stdio:'inherit'}`](https://nodejs.org/api/child_process.html#:~:text=%27inherit%27%3A%20Pass%20through%20the%20corresponding%20stdio%20stream%20to/from%20the%20parent%20process.%20In%20the%20first%20three%20positions%2C%20this%20is%20equivalent%20to%20process.stdin%2C%20process.stdout%2C%20and%20process.stderr%2C%20respectively.%20In%20any%20other%20position%2C%20equivalent%20to%20%27ignore%27.)? – Ricky Mo Jul 19 '23 at 03:26
  • @RickyMo i cant read the stdout with that – K.K Designs Jul 21 '23 at 00:12

0 Answers0