diff --git a/docs/reference/kubo/rpc.md b/docs/reference/kubo/rpc.md index 093bf53df..91b3e1e31 100644 --- a/docs/reference/kubo/rpc.md +++ b/docs/reference/kubo/rpc.md @@ -47,7 +47,7 @@ I AM SERIOUS, DO NOT EDIT ANYTHING BELOW ;-D --> -::: tip Generated on 2025-03-25, from kubo v0.34.1 +::: tip Generated on 2025-03-28, from kubo v0.34.1 This document was autogenerated from [v0.34.1](https://github.com/ipfs/kubo/releases/tag/v0.34.1). For issues and support, check out the [http-api-docs](https://github.com/ipfs/ipfs-docs/tree/main/tools/http-api-docs) generator on GitHub. ::: @@ -209,6 +209,12 @@ Argument `path` is of file type. This endpoint expects one or several files (dep The `add` command not only allows adding files, but also uploading directories and complex hierarchies. +For example, to upload multiple files and have them show up in a specific folder structure: + +``` +curl -sLk -XPOST -F "file=@file1.txt;filename=path1/file1.txt" -F \file=@file2.txt;filename=path2/file2.txt" "http://127.0.0.1:5001/api/v0/add?recursive=true&wrap-with-directory=true" +``` + This happens as follows: Every part in the multipart request is a *directory* or a *file* to be added to IPFS. Directory parts have a special content type `application/x-directory`. These parts do not carry any data. The part headers look as follows: @@ -230,7 +236,8 @@ Content-Type: application/octet-stream The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request. -The `Abspath` header is included for filestore/urlstore features that are enabled with the `nocopy` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL. +NOTE: The `Abspath` header is included for experimental filestore/urlstore features that are enabled with the `nocopy` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL. + ### Response diff --git a/package-lock.json b/package-lock.json index 7729fe732..24a34b516 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5108,9 +5108,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001664", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001664.tgz", - "integrity": "sha512-AmE7k4dXiNKQipgn7a2xg558IRqPN3jMQY/rOsbxDhrd0tyChwbITBfiwtnqz8bi2M5mIWbxAYBvk7W7QBUS2g==", + "version": "1.0.30001707", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", + "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", "dev": true, "funding": [ { @@ -25506,9 +25506,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001664", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001664.tgz", - "integrity": "sha512-AmE7k4dXiNKQipgn7a2xg558IRqPN3jMQY/rOsbxDhrd0tyChwbITBfiwtnqz8bi2M5mIWbxAYBvk7W7QBUS2g==", + "version": "1.0.30001707", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", + "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", "dev": true }, "caseless": { diff --git a/package.json b/package.json index 5c3f6f1d8..4bc731bf0 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,12 @@ "useTabs": false }, "lint-staged": { - "*.{js,json,css,less,scss,html,md,vue}": ["prettier --write"], - "*.styl": ["stylus-supremacy format --replace"] + "*.{js,json,css,less,scss,html,md,vue}": [ + "prettier --write" + ], + "*.styl": [ + "stylus-supremacy format --replace" + ] }, "husky": { "hooks": { diff --git a/tools/http-api-docs/markdown.go b/tools/http-api-docs/markdown.go index d97e2afa9..1a9e96557 100644 --- a/tools/http-api-docs/markdown.go +++ b/tools/http-api-docs/markdown.go @@ -352,6 +352,12 @@ Argument `+"`%s`"+` is of file type. This endpoint expects one or several files The `+"`add`"+` command not only allows adding files, but also uploading directories and complex hierarchies. +For example, to upload multiple files and have them show up in a specific folder structure: + +`+"```"+` +curl -sLk -XPOST -F "file=@file1.txt;filename=path1/file1.txt" -F \file=@file2.txt;filename=path2/file2.txt" "http://127.0.0.1:5001/api/v0/add?recursive=true&wrap-with-directory=true" +`+"```"+` + This happens as follows: Every part in the multipart request is a *directory* or a *file* to be added to IPFS. Directory parts have a special content type `+"`application/x-directory`"+`. These parts do not carry any data. The part headers look as follows: @@ -373,7 +379,8 @@ Content-Type: application/octet-stream The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request. -The `+"`Abspath`"+` header is included for filestore/urlstore features that are enabled with the `+"`nocopy`"+` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL. +NOTE: The `+"`Abspath`"+` header is included for experimental filestore/urlstore features that are enabled with the `+"`nocopy`"+` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL. + `) } return buf.String()