Skip to content

Commit 2d5794b

Browse files
fix: OS integrations for quick file import (#1691)
Co-authored-by: Rafael Ramalho <[email protected]>
1 parent ff49478 commit 2d5794b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/add-to-ipfs.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async function makeShareableObject (ipfs, results) {
3232
return results[0]
3333
}
3434

35-
let baseCID = await ipfs.object.new('unixfs-dir')
35+
let baseCID = await ipfs.object.new({ template: 'unixfs-dir' })
3636

3737
for (const { cid, path, size } of results) {
3838
baseCID = (await ipfs.object.patch.addLink(baseCID, {
@@ -87,11 +87,7 @@ module.exports = async function ({ getIpfsd, launchWebUI }, files) {
8787

8888
await Promise.all(files.map(async file => {
8989
try {
90-
let result = null
91-
for await (const res of ipfsd.api.add(globSource(file, { recursive: true }))) {
92-
result = res
93-
}
94-
90+
const result = await ipfsd.api.add(globSource(file, { recursive: true }))
9591
await copyFile(ipfsd.api, result.cid, result.path)
9692
successes.push(result)
9793
} catch (e) {

0 commit comments

Comments
 (0)