@abtnode/util 1.17.8-beta-20260121-102603-f9d0176f → 1.17.8-beta-20260125-093329-64b43854
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/lib/user.js +9 -0
- package/package.json +12 -12
package/lib/user.js
CHANGED
|
@@ -113,6 +113,14 @@ const extractUserAvatar = async (avatar, { dataDir } = {}) => {
|
|
|
113
113
|
return url;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
const convertImageToBase64 = async (url) => {
|
|
117
|
+
const response = await axios.get(url, { responseType: 'arraybuffer' });
|
|
118
|
+
const contentType = response.headers['content-type'] || 'image/png';
|
|
119
|
+
const buffer = Buffer.from(response.data, 'binary');
|
|
120
|
+
const base64 = buffer.toString('base64');
|
|
121
|
+
return `data:${contentType};base64,${base64}`;
|
|
122
|
+
};
|
|
123
|
+
|
|
116
124
|
/**
|
|
117
125
|
* generate base64 avatar data to from file by url
|
|
118
126
|
*/
|
|
@@ -222,4 +230,5 @@ module.exports = {
|
|
|
222
230
|
getUserAvatarUrl,
|
|
223
231
|
getAppAvatarUrl,
|
|
224
232
|
getServerAvatarUrl,
|
|
233
|
+
convertImageToBase64,
|
|
225
234
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.8-beta-
|
|
6
|
+
"version": "1.17.8-beta-20260125-093329-64b43854",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.17.8-beta-
|
|
22
|
-
"@abtnode/db-cache": "1.17.8-beta-
|
|
23
|
-
"@arcblock/did": "^1.28.
|
|
24
|
-
"@arcblock/event-hub": "^1.28.
|
|
21
|
+
"@abtnode/constant": "1.17.8-beta-20260125-093329-64b43854",
|
|
22
|
+
"@abtnode/db-cache": "1.17.8-beta-20260125-093329-64b43854",
|
|
23
|
+
"@arcblock/did": "^1.28.6",
|
|
24
|
+
"@arcblock/event-hub": "^1.28.6",
|
|
25
25
|
"@arcblock/pm2": "^6.0.12",
|
|
26
|
-
"@blocklet/constant": "1.17.8-beta-
|
|
26
|
+
"@blocklet/constant": "1.17.8-beta-20260125-093329-64b43854",
|
|
27
27
|
"@blocklet/error": "^0.3.5",
|
|
28
|
-
"@blocklet/meta": "1.17.8-beta-
|
|
28
|
+
"@blocklet/meta": "1.17.8-beta-20260125-093329-64b43854",
|
|
29
29
|
"@blocklet/xss": "^0.3.16",
|
|
30
|
-
"@ocap/client": "^1.28.
|
|
31
|
-
"@ocap/mcrypto": "^1.28.
|
|
32
|
-
"@ocap/util": "^1.28.
|
|
33
|
-
"@ocap/wallet": "^1.28.
|
|
30
|
+
"@ocap/client": "^1.28.6",
|
|
31
|
+
"@ocap/mcrypto": "^1.28.6",
|
|
32
|
+
"@ocap/util": "^1.28.6",
|
|
33
|
+
"@ocap/wallet": "^1.28.6",
|
|
34
34
|
"archiver": "^7.0.1",
|
|
35
35
|
"axios": "^1.7.9",
|
|
36
36
|
"axios-mock-adapter": "^2.1.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"express": "^4.18.2",
|
|
91
91
|
"fs-extra": "^11.2.0"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "241254785bda907be2296228869b4fc9c1679a6b"
|
|
94
94
|
}
|