dag-put does not seem to work #14

Open
opened 2024-11-28 20:56:58 -06:00 by chise · 0 comments

The first argument of the function dag-put is dag-node, but it seems strange.
When we put a dag piece into the IPFS, we usualy don't not know the CID of the input.
Perhaps the first API should be input.

For example:

(defun dag-put (input &key (format "cbor") (input-enc "json") (pin 'T))
  "Add a dag node to IPFS. Returns CID string.
  /ipns/docs.ipfs.io/reference/api/http/#api-v0-dag-put"
  (ipfs-call "dag/put" `(("format" ,format)
                         ("input-enc" ,input-enc) ("pin" ,pin))
	     :parameters (list input)))

This function works for both files and streams, as in the following example:

(dag-put '(:filename #P"/tmp/test\\.json"))
(let ((in (flexi-streams:make-in-memory-input-stream
		 (map 'vector #'char-code "{\"Hello\":\"world\"}"))))
	(dag-put `(:stream ,in)))

Thanks!

The first argument of the function `dag-put` is _dag-node_, but it seems strange. When we put a dag piece into the IPFS, we usualy don't not know the CID of the input. Perhaps the first API should be input. For example: ``` (defun dag-put (input &key (format "cbor") (input-enc "json") (pin 'T)) "Add a dag node to IPFS. Returns CID string. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dag-put" (ipfs-call "dag/put" `(("format" ,format) ("input-enc" ,input-enc) ("pin" ,pin)) :parameters (list input))) ``` This function works for both files and streams, as in the following example: ``` (dag-put '(:filename #P"/tmp/test\\.json")) ``` ``` (let ((in (flexi-streams:make-in-memory-input-stream (map 'vector #'char-code "{\"Hello\":\"world\"}")))) (dag-put `(:stream ,in))) ``` Thanks!
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jadedctrl/cl-ipfs-api2#14
No description provided.