chickadee » ipfs » writer/file

writer/file path #!key name (headers '())procedure
writer/directory path #!key name (headers '())procedure
writer/filesystem path #!key test limit dotfiles follow-symlinksprocedure
writer/port port #!key name (headers '())procedure
writer/string string name #!optional (headers '())procedure
writer/file* path #!key name (headers '())procedure
writer/directory* path #!key name (headers '())procedure
writer/port* port #!key name (headers '())procedure
writer/string* string name #!optional (headers '())procedure

Convenience procedures to use as the writer given to with-input-from-request.

name is the name of the file to be given to Kubo, that is, the name that Kubo will use to save it. It is URI-encoded before sending.

headers is an alist of headers to use for an specific entry. See with-input-from-request.

writer/file can be used to send a single file to the Kubo node. path is the path to the file you want to send, and it must be accessible by the client (this library), not the Kubo node. name defaults to the basename of path. This allows special characters, such as /, so you can send a path.

writer/directory can be used to send a single directory to the Kubo node. The arguments of this function are similar to those of writer/file. NOTE: This does not send other files or directories contained in the specified directory, only an empty directory. For sending a file tree read next.

writer/filesystem can be used to send a file tree to the Kubo node. path specifies the root of the tree you want to send. For details on the other parameters see the documentation for find-files of (chicken file).

writer/port can be used to send the contents of a port to the Kubo node. If name is not given, with-input-from-request tries to use the port's own name.

writer/string can be used to send a string as the contents of a file to the Kubo node.

If none of these procedures quite fit your requirements, you can always build the writer list to pass to with-input-from-request yourself. writer/file*, writer/directory*, writer/port*, and writer/string* may prove useful. They're similar to their non-asterisked counterparts, but they return a single entry instead of an entry wrapped in a list. See the examples section.

For more details, see writer/internal and writer/internal*.