/api/v0/files/write

Append to (modify) a file in MFS.

Arguments

  • arg [string]: Path to write to. Required: yes.

  • offset [int64]: Byte offset to begin writing at. Required: no.

  • create [bool]: Create the file if it does not exist. Required: no.

  • parents [bool]: Make parent directories as needed. Required: no.

  • truncate [bool]: Truncate the file to size zero before writing. Required: no.

  • count [int64]: Maximum number of bytes to read. Required: no.

  • raw-leaves [bool]: Use raw blocks for newly created leaf nodes. (experimental). Required: no.

  • cid-version [int]: Cid version to use. (experimental). Required: no.

  • hash [string]: Hash function to use. Will set Cid version to 1 if used. (experimental). Required: no.

Request Body

Argument data is of file type. This endpoint expects one or several files (depending on the command) in the body of the request as 'multipart/form-data'.

Response

On success, the call to this endpoint will return with 200 and the following body:

This endpoint returns a `text/plain` response body.

cURL Example

curl -X POST -F file=@myfile "http://127.0.0.1:5001/api/v0/files/write?arg=<path>&offset=<value>&create=<value>&parents=<value>&truncate=<value>&count=<value>&raw-leaves=<value>&cid-version=<value>&hash=<value>"

Last updated