@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.
Files changed (3) hide show
  1. package/date_time.js +1 -1
  2. package/file.js +13 -0
  3. package/package.json +1 -1
package/date_time.js CHANGED
@@ -96,7 +96,7 @@ class DateTime {
96
96
  }
97
97
 
98
98
  static getTimestamp(jsDate) {
99
- return jsDate.getTime();
99
+ return jsDate.getTime()/1000;
100
100
  }
101
101
 
102
102
  static getDateDigitalDisplay(jsDate, locale="fr-FR", timeZone="Europe/Paris") {
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"