@ethersphere/bee-js 3.3.2-pre.1 → 3.3.3

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 (42) hide show
  1. package/dist/mjs/bee-debug.js +294 -189
  2. package/dist/mjs/bee.js +316 -237
  3. package/dist/mjs/chunk/signer.js +46 -12
  4. package/dist/mjs/chunk/soc.js +71 -31
  5. package/dist/mjs/chunk/span.js +1 -1
  6. package/dist/mjs/feed/index.js +86 -42
  7. package/dist/mjs/feed/json.js +46 -10
  8. package/dist/mjs/index.js +2 -1
  9. package/dist/mjs/modules/bytes.js +61 -24
  10. package/dist/mjs/modules/bzz.js +96 -58
  11. package/dist/mjs/modules/chunk.js +51 -16
  12. package/dist/mjs/modules/debug/balance.js +60 -20
  13. package/dist/mjs/modules/debug/chequebook.js +115 -67
  14. package/dist/mjs/modules/debug/chunk.js +47 -11
  15. package/dist/mjs/modules/debug/connectivity.js +76 -32
  16. package/dist/mjs/modules/debug/settlements.js +46 -10
  17. package/dist/mjs/modules/debug/stamps.js +91 -47
  18. package/dist/mjs/modules/debug/states.js +48 -12
  19. package/dist/mjs/modules/debug/status.js +97 -49
  20. package/dist/mjs/modules/debug/tag.js +39 -5
  21. package/dist/mjs/modules/debug/transactions.js +65 -25
  22. package/dist/mjs/modules/feed.js +50 -16
  23. package/dist/mjs/modules/pinning.js +67 -27
  24. package/dist/mjs/modules/pss.js +44 -10
  25. package/dist/mjs/modules/soc.js +47 -14
  26. package/dist/mjs/modules/status.js +37 -3
  27. package/dist/mjs/modules/stewardship.js +46 -10
  28. package/dist/mjs/modules/tag.js +73 -31
  29. package/dist/mjs/utils/collection.browser.js +41 -4
  30. package/dist/mjs/utils/collection.js +45 -11
  31. package/dist/mjs/utils/collection.node.js +137 -42
  32. package/dist/mjs/utils/data.browser.js +88 -52
  33. package/dist/mjs/utils/data.js +57 -21
  34. package/dist/mjs/utils/error.js +0 -9
  35. package/dist/mjs/utils/eth.js +68 -32
  36. package/dist/mjs/utils/file.js +42 -8
  37. package/dist/mjs/utils/headers.js +4 -4
  38. package/dist/mjs/utils/http.js +110 -64
  39. package/dist/mjs/utils/merge.js +2 -2
  40. package/dist/mjs/utils/stream.js +0 -4
  41. package/dist/mjs/utils/type.js +6 -6
  42. package/package.json +2 -2
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { extractUploadHeaders } from "../utils/headers.js";
2
34
  import { http } from "../utils/http.js";
3
35
  const socEndpoint = 'soc';
@@ -13,19 +45,20 @@ const socEndpoint = 'soc';
13
45
  * @param options Additional options like tag, encryption, pinning
14
46
  */
15
47
 
16
- export async function upload(ky, owner, identifier, signature, data, postageBatchId, options) {
17
- const response = await http(ky, {
18
- method: 'post',
19
- path: `${socEndpoint}/${owner}/${identifier}`,
20
- body: data,
21
- headers: {
22
- 'content-type': 'application/octet-stream',
23
- ...extractUploadHeaders(postageBatchId, options)
24
- },
25
- responseType: 'json',
26
- searchParams: {
27
- sig: signature
28
- }
48
+ export function upload(ky, owner, identifier, signature, data, postageBatchId, options) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const response = yield http(ky, {
51
+ method: 'post',
52
+ path: `${socEndpoint}/${owner}/${identifier}`,
53
+ body: data,
54
+ headers: Object.assign({
55
+ 'content-type': 'application/octet-stream'
56
+ }, extractUploadHeaders(postageBatchId, options)),
57
+ responseType: 'json',
58
+ searchParams: {
59
+ sig: signature
60
+ }
61
+ });
62
+ return response.data.reference;
29
63
  });
30
- return response.data.reference;
31
64
  }
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../utils/http.js";
2
34
  /**
3
35
  * Ping the base bee URL. If connection was not successful throw error
@@ -5,8 +37,10 @@ import { http } from "../utils/http.js";
5
37
  * @param ky Ky instance for given Bee class instance
6
38
  */
7
39
 
8
- export async function checkConnection(ky) {
9
- await http(ky, {
10
- path: ''
40
+ export function checkConnection(ky) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ yield http(ky, {
43
+ path: ''
44
+ });
11
45
  });
12
46
  }
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../utils/http.js";
2
34
  const stewardshipEndpoint = 'stewardship';
3
35
  /**
@@ -8,17 +40,21 @@ const stewardshipEndpoint = 'stewardship';
8
40
  * @throws BeeResponseError if not locally pinned or invalid data
9
41
  */
10
42
 
11
- export async function reupload(ky, reference) {
12
- await http(ky, {
13
- method: 'put',
14
- path: `${stewardshipEndpoint}/${reference}`
43
+ export function reupload(ky, reference) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ yield http(ky, {
46
+ method: 'put',
47
+ path: `${stewardshipEndpoint}/${reference}`
48
+ });
15
49
  });
16
50
  }
17
- export async function isRetrievable(ky, reference) {
18
- const response = await http(ky, {
19
- method: 'get',
20
- responseType: 'json',
21
- path: `${stewardshipEndpoint}/${reference}`
51
+ export function isRetrievable(ky, reference) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const response = yield http(ky, {
54
+ method: 'get',
55
+ responseType: 'json',
56
+ path: `${stewardshipEndpoint}/${reference}`
57
+ });
58
+ return response.data.isRetrievable;
22
59
  });
23
- return response.data.isRetrievable;
24
60
  }
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { http } from "../utils/http.js";
2
34
  const endpoint = 'tags';
3
35
  /**
@@ -6,13 +38,15 @@ const endpoint = 'tags';
6
38
  * @param url Bee tag URL
7
39
  */
8
40
 
9
- export async function createTag(ky) {
10
- const response = await http(ky, {
11
- method: 'post',
12
- path: endpoint,
13
- responseType: 'json'
41
+ export function createTag(ky) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const response = yield http(ky, {
44
+ method: 'post',
45
+ path: endpoint,
46
+ responseType: 'json'
47
+ });
48
+ return response.data;
14
49
  });
15
- return response.data;
16
50
  }
17
51
  /**
18
52
  * Retrieve tag information from Bee node
@@ -21,12 +55,14 @@ export async function createTag(ky) {
21
55
  * @param uid UID of tag to be retrieved
22
56
  */
23
57
 
24
- export async function retrieveTag(ky, uid) {
25
- const response = await http(ky, {
26
- path: `${endpoint}/${uid}`,
27
- responseType: 'json'
58
+ export function retrieveTag(ky, uid) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const response = yield http(ky, {
61
+ path: `${endpoint}/${uid}`,
62
+ responseType: 'json'
63
+ });
64
+ return response.data;
28
65
  });
29
- return response.data;
30
66
  }
31
67
  /**
32
68
  * Get limited listing of all tags.
@@ -36,16 +72,18 @@ export async function retrieveTag(ky, uid) {
36
72
  * @param limit
37
73
  */
38
74
 
39
- export async function getAllTags(ky, offset, limit) {
40
- const response = await http(ky, {
41
- path: `${endpoint}`,
42
- searchParams: {
43
- offset,
44
- limit
45
- },
46
- responseType: 'json'
75
+ export function getAllTags(ky, offset, limit) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const response = yield http(ky, {
78
+ path: `${endpoint}`,
79
+ searchParams: {
80
+ offset,
81
+ limit
82
+ },
83
+ responseType: 'json'
84
+ });
85
+ return response.data.tags;
47
86
  });
48
- return response.data.tags;
49
87
  }
50
88
  /**
51
89
  * Removes tag from the Bee node.
@@ -53,10 +91,12 @@ export async function getAllTags(ky, offset, limit) {
53
91
  * @param uid
54
92
  */
55
93
 
56
- export async function deleteTag(ky, uid) {
57
- await http(ky, {
58
- method: 'delete',
59
- path: `${endpoint}/${uid}`
94
+ export function deleteTag(ky, uid) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ yield http(ky, {
97
+ method: 'delete',
98
+ path: `${endpoint}/${uid}`
99
+ });
60
100
  });
61
101
  }
62
102
  /**
@@ -66,12 +106,14 @@ export async function deleteTag(ky, uid) {
66
106
  * @param reference
67
107
  */
68
108
 
69
- export async function updateTag(ky, uid, reference) {
70
- await http(ky, {
71
- method: 'patch',
72
- path: `${endpoint}/${uid}`,
73
- json: {
74
- reference
75
- }
109
+ export function updateTag(ky, uid, reference) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ yield http(ky, {
112
+ method: 'patch',
113
+ path: `${endpoint}/${uid}`,
114
+ json: {
115
+ reference
116
+ }
117
+ });
76
118
  });
77
119
  }
@@ -1,11 +1,46 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
1
32
  /**
2
33
  * Creates array in the format of Collection with data loaded from directory on filesystem.
3
34
  * The function loads all the data into memory!
4
35
  *
5
36
  * @param dir path to the directory
6
37
  */
7
- export async function makeCollectionFromFS(dir) {
8
- throw new Error('Creating Collection from File System is not supported in browsers!');
38
+
39
+
40
+ export function makeCollectionFromFS(dir) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ throw new Error('Creating Collection from File System is not supported in browsers!');
43
+ });
9
44
  }
10
45
  /**
11
46
  * Calculate folder size recursively
@@ -14,6 +49,8 @@ export async function makeCollectionFromFS(dir) {
14
49
  * @returns size in bytes
15
50
  */
16
51
 
17
- export async function getFolderSize(dir) {
18
- throw new Error('Creating Collection from File System is not supported in browsers!');
52
+ export function getFolderSize(dir) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ throw new Error('Creating Collection from File System is not supported in browsers!');
55
+ });
19
56
  }
@@ -1,3 +1,35 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
1
33
  import { BeeArgumentError } from "./error.js";
2
34
  import { fileArrayBuffer } from "./file.js";
3
35
  import { isUint8Array } from "./type.js";
@@ -26,21 +58,23 @@ function makeFilePath(file) {
26
58
  throw new TypeError('file is not valid File object');
27
59
  }
28
60
 
29
- export async function makeCollectionFromFileList(fileList) {
30
- const collection = [];
61
+ export function makeCollectionFromFileList(fileList) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const collection = [];
31
64
 
32
- for (let i = 0; i < fileList.length; i++) {
33
- const file = fileList[i];
65
+ for (let i = 0; i < fileList.length; i++) {
66
+ const file = fileList[i];
34
67
 
35
- if (file) {
36
- collection.push({
37
- path: makeFilePath(file),
38
- data: new Uint8Array(await fileArrayBuffer(file))
39
- });
68
+ if (file) {
69
+ collection.push({
70
+ path: makeFilePath(file),
71
+ data: new Uint8Array(yield fileArrayBuffer(file))
72
+ });
73
+ }
40
74
  }
41
- }
42
75
 
43
- return collection;
76
+ return collection;
77
+ });
44
78
  }
45
79
  /**
46
80
  * Calculate cumulative size of files
@@ -1,3 +1,61 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) {
10
+ try {
11
+ step(generator.next(value));
12
+ } catch (e) {
13
+ reject(e);
14
+ }
15
+ }
16
+
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+
25
+ function step(result) {
26
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
27
+ }
28
+
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+
33
+ var __asyncValues = this && this.__asyncValues || function (o) {
34
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
35
+ var m = o[Symbol.asyncIterator],
36
+ i;
37
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
38
+ return this;
39
+ }, i);
40
+
41
+ function verb(n) {
42
+ i[n] = o[n] && function (v) {
43
+ return new Promise(function (resolve, reject) {
44
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
45
+ });
46
+ };
47
+ }
48
+
49
+ function settle(resolve, reject, d, v) {
50
+ Promise.resolve(v).then(function (v) {
51
+ resolve({
52
+ value: v,
53
+ done: d
54
+ });
55
+ }, reject);
56
+ }
57
+ };
58
+
1
59
  import fs from 'fs';
2
60
  import path from 'path';
3
61
  /**
@@ -7,39 +65,58 @@ import path from 'path';
7
65
  * @param dir path to the directory
8
66
  */
9
67
 
10
- export async function makeCollectionFromFS(dir) {
11
- if (typeof dir !== 'string') {
12
- throw new TypeError('dir has to be string!');
13
- }
68
+ export function makeCollectionFromFS(dir) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ if (typeof dir !== 'string') {
71
+ throw new TypeError('dir has to be string!');
72
+ }
14
73
 
15
- if (dir === '') {
16
- throw new TypeError('dir must not be empty string!');
17
- }
74
+ if (dir === '') {
75
+ throw new TypeError('dir must not be empty string!');
76
+ }
18
77
 
19
- return buildCollectionRelative(dir, '');
78
+ return buildCollectionRelative(dir, '');
79
+ });
20
80
  }
21
81
 
22
- async function buildCollectionRelative(dir, relativePath) {
23
- // Handles case when the dir is not existing or it is a file ==> throws an error
24
- const dirname = path.join(dir, relativePath);
25
- const entries = await fs.promises.opendir(dirname);
26
- let collection = [];
82
+ function buildCollectionRelative(dir, relativePath) {
83
+ var e_1, _a;
27
84
 
28
- for await (const entry of entries) {
29
- const fullPath = path.join(dir, relativePath, entry.name);
30
- const entryPath = path.join(relativePath, entry.name);
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ // Handles case when the dir is not existing or it is a file ==> throws an error
87
+ const dirname = path.join(dir, relativePath);
88
+ const entries = yield fs.promises.opendir(dirname);
89
+ let collection = [];
31
90
 
32
- if (entry.isFile()) {
33
- collection.push({
34
- path: entryPath,
35
- data: new Uint8Array(await fs.promises.readFile(fullPath))
36
- });
37
- } else if (entry.isDirectory()) {
38
- collection = [...(await buildCollectionRelative(dir, entryPath)), ...collection];
91
+ try {
92
+ for (var entries_1 = __asyncValues(entries), entries_1_1; entries_1_1 = yield entries_1.next(), !entries_1_1.done;) {
93
+ const entry = entries_1_1.value;
94
+ const fullPath = path.join(dir, relativePath, entry.name);
95
+ const entryPath = path.join(relativePath, entry.name);
96
+
97
+ if (entry.isFile()) {
98
+ collection.push({
99
+ path: entryPath,
100
+ data: new Uint8Array(yield fs.promises.readFile(fullPath))
101
+ });
102
+ } else if (entry.isDirectory()) {
103
+ collection = [...(yield buildCollectionRelative(dir, entryPath)), ...collection];
104
+ }
105
+ }
106
+ } catch (e_1_1) {
107
+ e_1 = {
108
+ error: e_1_1
109
+ };
110
+ } finally {
111
+ try {
112
+ if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) yield _a.call(entries_1);
113
+ } finally {
114
+ if (e_1) throw e_1.error;
115
+ }
39
116
  }
40
- }
41
117
 
42
- return collection;
118
+ return collection;
119
+ });
43
120
  }
44
121
  /**
45
122
  * Calculate folder size recursively
@@ -49,26 +126,44 @@ async function buildCollectionRelative(dir, relativePath) {
49
126
  */
50
127
 
51
128
 
52
- export async function getFolderSize(dir) {
53
- if (typeof dir !== 'string') {
54
- throw new TypeError('dir has to be string!');
55
- }
129
+ export function getFolderSize(dir) {
130
+ var e_2, _a;
56
131
 
57
- if (dir === '') {
58
- throw new TypeError('dir must not be empty string!');
59
- }
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ if (typeof dir !== 'string') {
134
+ throw new TypeError('dir has to be string!');
135
+ }
60
136
 
61
- const entries = await fs.promises.opendir(dir);
62
- let size = 0;
137
+ if (dir === '') {
138
+ throw new TypeError('dir must not be empty string!');
139
+ }
63
140
 
64
- for await (const entry of entries) {
65
- if (entry.isFile()) {
66
- const stats = await fs.promises.stat(path.join(dir, entry.name));
67
- size += stats.size;
68
- } else if (entry.isDirectory()) {
69
- size += await getFolderSize(path.join(dir, entry.name));
141
+ const entries = yield fs.promises.opendir(dir);
142
+ let size = 0;
143
+
144
+ try {
145
+ for (var entries_2 = __asyncValues(entries), entries_2_1; entries_2_1 = yield entries_2.next(), !entries_2_1.done;) {
146
+ const entry = entries_2_1.value;
147
+
148
+ if (entry.isFile()) {
149
+ const stats = yield fs.promises.stat(path.join(dir, entry.name));
150
+ size += stats.size;
151
+ } else if (entry.isDirectory()) {
152
+ size += yield getFolderSize(path.join(dir, entry.name));
153
+ }
154
+ }
155
+ } catch (e_2_1) {
156
+ e_2 = {
157
+ error: e_2_1
158
+ };
159
+ } finally {
160
+ try {
161
+ if (entries_2_1 && !entries_2_1.done && (_a = entries_2.return)) yield _a.call(entries_2);
162
+ } finally {
163
+ if (e_2) throw e_2.error;
164
+ }
70
165
  }
71
- }
72
166
 
73
- return size;
167
+ return size;
168
+ });
74
169
  }