@sumaris-net/ngx-components 2.4.29 → 2.4.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21084,6 +21084,20 @@ class JsonUtils {
21084
21084
  blob['name'] = opts.filename;
21085
21085
  return blob;
21086
21086
  }
21087
+ static parseFile(file, opts) {
21088
+ return FilesUtils.readAsText(file, opts?.encoding)
21089
+ .pipe(map(e => {
21090
+ if (e.type === HttpEventType.UploadProgress) {
21091
+ const loaded = Math.round(e.loaded * 0.8);
21092
+ return { ...e, loaded };
21093
+ }
21094
+ else if (e instanceof FileResponse) {
21095
+ const body = e.body;
21096
+ const data = JSON.parse(body);
21097
+ return new FileResponse({ body: data });
21098
+ }
21099
+ }), filter(isNotNil));
21100
+ }
21087
21101
  }
21088
21102
 
21089
21103
  /**