@osimatic/helpers-js 1.1.25 → 1.1.26
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/date_time.js +1 -1
- package/file.js +13 -0
- package/package.json +1 -1
package/date_time.js
CHANGED
package/file.js
CHANGED
|
@@ -131,6 +131,19 @@ class Img {
|
|
|
131
131
|
var urlCreator = window.URL || window.webkitURL;
|
|
132
132
|
img.attr('src', urlCreator.createObjectURL(blob));
|
|
133
133
|
}
|
|
134
|
+
|
|
135
|
+
static async getBase64FromUrl(url) {
|
|
136
|
+
const data = await fetch(url);
|
|
137
|
+
const blob = await data.blob();
|
|
138
|
+
return new Promise((resolve) => {
|
|
139
|
+
const reader = new FileReader();
|
|
140
|
+
reader.readAsDataURL(blob);
|
|
141
|
+
reader.onloadend = () => {
|
|
142
|
+
const base64data = reader.result;
|
|
143
|
+
resolve(base64data);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
134
147
|
}
|
|
135
148
|
|
|
136
149
|
module.exports = { File, CSV, Img };
|