Skip to content

Commit

Permalink
fix: long directories on cluster
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Aug 5, 2019
1 parent 2302653 commit b8f3f9e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pinners/ipfs-cluster.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs')
const path = require('path')
const recursive = require('recursive-fs')
const ipfsCluster = require('ipfs-cluster-api')
const multiaddr = require('multiaddr')
Expand Down Expand Up @@ -29,12 +30,14 @@ IPFS_DEPLOY_IPFS_CLUSTER__PASSWORD`)
})
},
pinDir: async (cluster, dir, tag) => {
dir = path.normalize(dir)
const toStrip = path.dirname(dir).length
const files = await new Promise(resolve => {
recursive.readdirr(dir, (_err, _dirs, files) => {
resolve(
files.map(f => ({
path: f,
content: fs.createReadStream(f)
files.map(file => ({
path: file.slice(toStrip),
content: fs.createReadStream(file)
}))
)
})
Expand Down

0 comments on commit b8f3f9e

Please sign in to comment.