f5devcentral / f5-corkscrew

TMOS parser and application extractor
Apache License 2.0
13 stars 3 forks source link

[RFE] add events to parse and app extraction functions to provide processing feedback #5

Closed DumpySquare closed 3 years ago

DumpySquare commented 3 years ago

The idea here is to provide some way for the functions to provide a status of how much processing needs to be done and how far along in that processing it is.

Like axios onUploadProgress and onDownloadProgress (but it does seem that is only availible in browser) https://github.com/axios/axios#request-config

  // `onUploadProgress` allows handling of progress events for uploads
  // browser only
  onUploadProgress: function (progressEvent) {
    // Do whatever you want with the native progress event
  },

  // `onDownloadProgress` allows handling of progress events for downloads
  // browser only
  onDownloadProgress: function (progressEvent) {
    // Do whatever you want with the native progress event
  },

What about fs stream? https://www.npmjs.com/package/progress-stream

It seems that events are used to emit information during a processing function. At a minimum, I'd like to add event information to the parse() function: on.start -> provide details about incoming file/string on,pre-parse -> provide number of objects detected on.parse -> return details about what object # is currently being parsed on.done -> return message about completed parsing details (total items parsed and processingTime)

This event information could be passed back up the chain and used by command line progress bars to provide a visual processin status for large configs. This could also get plugged into vscode extension progress bars.

DumpySquare commented 3 years ago

complete