From 021baff92af1393372ae1ef12cb2f6845a4c54c6 Mon Sep 17 00:00:00 2001 From: Joe Hand Date: Thu, 6 Apr 2017 12:40:17 -0700 Subject: [PATCH] throw error for download without dest --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 0323ebf..6eb5d05 100644 --- a/index.js +++ b/index.js @@ -34,6 +34,9 @@ function run (src, dest, opts, cb) { var archive = hyperdrive(storage(), key, opts) archive.on('ready', function () { + if (!archive.metadata.writable && !dest) { + return cb(new Error('Archive is not writable and no destination provided.')) + } if (archive.metadata.writable) importFiles() else downloadFiles() var swarm = joinNetwork()