From c78e29f613085040b1dc93063a69ccb0ebc19ab2 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Fri, 18 Oct 2019 13:48:31 +0100 Subject: [PATCH] docs: update block rm description Documents `result` type correctly, what it contains and why. --- SPEC/BLOCK.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SPEC/BLOCK.md b/SPEC/BLOCK.md index f0b396827..3319cd299 100644 --- a/SPEC/BLOCK.md +++ b/SPEC/BLOCK.md @@ -125,12 +125,11 @@ A great source of [examples][] can be found in the tests for this API. - force (boolean): Ignores nonexistent blocks. - quiet (boolean): write minimal output -`callback` must follow `function (err, result) {}` signature, where `err` is an error if the operation was not successful and `result` is an object, containing hash and error strings. +`callback` must follow `function (err, result) {}` signature, where `err` is an error if the operation was not successful and `result` is a list of objects, containing hash and (potentially) error strings. -If no `callback` is passed, a promise is returned. +If an error string is present for a given object in `result`, the block with that hash was not removed and the string will contain the reason why, for example if the block was pinned. -NOTE: If the specified block is pinned it won't be removed and no error -will be returned +If no `callback` is passed, a promise is returned. **Example:** @@ -139,7 +138,7 @@ ipfs.block.rm(cid, function (err, result) { if (err) { throw err } - console.log(result.hash) + console.log(result[0].hash) }) ```