From 930b6a55edceb029f9c6cc619d7d5b3b8e3b3471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Tue, 13 Jun 2017 15:43:06 +0900 Subject: [PATCH] make ipfs add --nocopy works a bit more provide the Abspath header in the stream for file so the filestore can find the actual file on disk It works but I still get errors like 'Error: expected protobuf dag node' sometimes --- src/get-files-stream.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/get-files-stream.js b/src/get-files-stream.js index c6f2c48df..7fd715dd2 100644 --- a/src/get-files-stream.js +++ b/src/get-files-stream.js @@ -16,6 +16,7 @@ function headers (file) { } else if (file.symlink) { header['Content-Type'] = 'application/symlink' } else { + header['Abspath'] = file.absPath header['Content-Type'] = 'application/octet-stream' } @@ -69,6 +70,7 @@ function loadPaths (opts, file) { // files if (mg.cache[name] === 'FILE') { return { + absPath: name, path: strip(name, file), symlink: false, dir: false, @@ -91,6 +93,7 @@ function loadPaths (opts, file) { } return { + absPath: file, path: path.basename(file), content: fs.createReadStream(file) } @@ -122,6 +125,7 @@ function getFilesStream (files, opts) { } return { + absPath: '', path: '', symlink: false, dir: false,