Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

flattened multipart message and new ipfsAPI().add API #178

Closed
@daviddias

Description

@daviddias

The latest 0.4.0 version has an update on what it is expecting when it comes to multipart messages which breaks how ipfs add -r. multipart messages have been historically a pain to handle, parse and construct. A new and cleaner way to do it is simply to flat the multipart messages (avoiding the nesting).

In order to let the IPFS HTTP API to know if we are sending a file, directory or symlink, ipfsAPI client will send the following "Content-Type":

  • application/x-directory when it is a directory
  • application/x-symlink when it is a symlink
  • application/octet-stream when it is a file

The .add interface is going to be updated to:

.add(buffer)                   (browser + node.js)
.add(stream)                   (browser + node.js)
.add(path)                     (node.js)
.add(array of paths)           (node.js)
.add(path, {recursive: true})  (node.js)
.add([                         (browser + node.js)
  { /a/b”: <stream or buffer> } 
  { /a/e/f”: <stream or buffer> }, 
  {/a/eeee/: true},            -> Sinalize it is a directory
  { /a/im-a-symlink”: /a/}     -> Creates a symlink
])

This calls will create always a flatened multipart message

@whyrusleeping @dignifiedquire

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions