Skip to content

Commit

Permalink
fix: OS integrations for quick file import (ipfs#1691)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafael Ramalho <[email protected]>
  • Loading branch information
lidel and rafaelramalho19 authored Oct 12, 2020
1 parent ff49478 commit 2d5794b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/add-to-ipfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function makeShareableObject (ipfs, results) {
return results[0]
}

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

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

await Promise.all(files.map(async file => {
try {
let result = null
for await (const res of ipfsd.api.add(globSource(file, { recursive: true }))) {
result = res
}

const result = await ipfsd.api.add(globSource(file, { recursive: true }))
await copyFile(ipfsd.api, result.cid, result.path)
successes.push(result)
} catch (e) {
Expand Down

0 comments on commit 2d5794b

Please sign in to comment.