File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/tutorials/0005-regular-files-api Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
const validate = async ( result , ipfs ) => {
2
2
const uploadedFiles = window . uploadedFiles || false
3
+ const expectedResult = [ ]
3
4
4
- const expectedResult = await ipfs . add ( window . uploadedFiles )
5
+ for await ( const result of ipfs . add ( window . uploadedFiles ) ) {
6
+ expectedResult . push ( result )
7
+ }
5
8
6
9
if ( ! result ) {
7
10
return {
@@ -48,7 +51,11 @@ const validate = async (result, ipfs) => {
48
51
49
52
const code = `/* global ipfs */
50
53
const run = async (files) => {
51
- const result = // Place your code to add a file or files here
54
+ const result = []
55
+
56
+ for await (const resultPart of ) {
57
+ // Place your code to add a file or files here and on the for await of loop
58
+ }
52
59
53
60
return result
54
61
}
@@ -57,7 +64,11 @@ return run
57
64
58
65
const solution = `/* global ipfs */
59
66
const run = async (files) => {
60
- const result = await ipfs.add(files)
67
+ const result = []
68
+
69
+ for await (const resultPart of ipfs.add(files)) {
70
+ result.push(resultPart)
71
+ }
61
72
62
73
return result
63
74
}
You can’t perform that action at this time.
0 commit comments