dts-backoffice-util 14.1.0 → 14.2.1
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.
- package/README.md +21 -7
- package/esm2020/lib/utils/file.util.mjs +24 -2
- package/fesm2015/dts-backoffice-util.mjs +23 -1
- package/fesm2015/dts-backoffice-util.mjs.map +1 -1
- package/fesm2020/dts-backoffice-util.mjs +23 -1
- package/fesm2020/dts-backoffice-util.mjs.map +1 -1
- package/lib/utils/file.util.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1235,7 +1235,7 @@ class FileUtil {
|
|
|
1235
1235
|
const binaryData = [file];
|
|
1236
1236
|
const downloadLink = document.createElement('a');
|
|
1237
1237
|
const urlDownload = window.URL.createObjectURL(new Blob(binaryData, { type: file.type }));
|
|
1238
|
-
|
|
1238
|
+
/* Verifica se é ie ou edge, pois o mesmo tem tratamento próprio para arquivos blob */
|
|
1239
1239
|
const nav = window.navigator;
|
|
1240
1240
|
if (nav && nav.msSaveOrOpenBlob) {
|
|
1241
1241
|
nav.msSaveOrOpenBlob(file, fileName);
|
|
@@ -1324,6 +1324,28 @@ class FileUtil {
|
|
|
1324
1324
|
}, columnHeader + lineDelimiter);
|
|
1325
1325
|
return lineStr;
|
|
1326
1326
|
}
|
|
1327
|
+
static fileToB64(file) {
|
|
1328
|
+
return new Promise((resolve, reject) => {
|
|
1329
|
+
const reader = new FileReader();
|
|
1330
|
+
reader.readAsDataURL(file);
|
|
1331
|
+
reader.onload = () => {
|
|
1332
|
+
let cntFile;
|
|
1333
|
+
cntFile = reader.result;
|
|
1334
|
+
if (!cntFile) {
|
|
1335
|
+
reject('File not found or Empty');
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
const aCnt = cntFile.split(',');
|
|
1339
|
+
if (aCnt && aCnt.length >= 2) {
|
|
1340
|
+
resolve(aCnt[1]);
|
|
1341
|
+
}
|
|
1342
|
+
else {
|
|
1343
|
+
reject('File not found or Empty');
|
|
1344
|
+
}
|
|
1345
|
+
};
|
|
1346
|
+
reader.onerror = error => reject(error);
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1327
1349
|
}
|
|
1328
1350
|
class DownloadDataParams {
|
|
1329
1351
|
}
|