{"id":20263533,"url":"https://github.com/fleekhq/space-client","last_synced_at":"2025-10-09T17:37:34.245Z","repository":{"id":40762849,"uuid":"275916068","full_name":"FleekHQ/space-client","owner":"FleekHQ","description":"File Upload (encrypted), File Sharing, Filecoin Markets (TBD), and User Controlled Data. You can access same methods from the Space Daemon using our JS client, so you don't need to worry about gRPC calls.","archived":false,"fork":false,"pushed_at":"2023-01-07T19:37:34.000Z","size":2466,"stargazers_count":77,"open_issues_count":20,"forks_count":8,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-09-24T20:31:55.119Z","etag":null,"topics":["client","decentralization","file-storage","filesystem-library","javascript-library","storage"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FleekHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-29T20:11:57.000Z","updated_at":"2025-03-30T00:47:00.000Z","dependencies_parsed_at":"2023-02-07T23:16:07.100Z","dependency_job_id":null,"html_url":"https://github.com/FleekHQ/space-client","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/FleekHQ/space-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FleekHQ%2Fspace-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FleekHQ%2Fspace-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FleekHQ%2Fspace-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FleekHQ%2Fspace-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FleekHQ","download_url":"https://codeload.github.com/FleekHQ/space-client/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FleekHQ%2Fspace-client/sbom","scorecard":{"id":50897,"data":{"date":"2025-08-11","repo":{"name":"github.com/FleekHQ/space-client","commit":"a646dc4eaf605ab0a281d8c3d9302a2af5041140"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/FleekHQ/space-client/publish.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/FleekHQ/space-client/publish.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/FleekHQ/space-client/tests.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/FleekHQ/space-client/tests.yml/develop?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"47 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T23:40:51.129Z","repository_id":40762849,"created_at":"2025-08-14T23:40:51.129Z","updated_at":"2025-08-14T23:40:51.129Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001868,"owners_count":26083197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","decentralization","file-storage","filesystem-library","javascript-library","storage"],"created_at":"2024-11-14T11:35:28.196Z","updated_at":"2025-10-09T17:37:34.228Z","avatar_url":"https://github.com/FleekHQ.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Publish Action Status](https://github.com/FleekHQ/space-client/workflows/Publish/badge.svg?branch=master)\n![Tests Action Status](https://github.com/FleekHQ/space-client/workflows/Tests/badge.svg)\n\n# Space Client\n\n## Overview\nSpace Client it's a [grpc-web](https://www.npmjs.com/package/grpc-web) wrapper that allows you to connect with the [space daemon](https://github.com/FleekHQ/space-daemon) and interact with it.\n\n\n#### Initialize client\n\u003e Before initialize the client you need to have the [space-daemon](https://github.com/FleekHQ/space-daemon) up and running. You can find the daemon installation docs [here](https://github.com/FleekHQ/space-daemon#installation)\n\n\nPlease have in mind that [daemon](https://github.com/FleekHQ/space-daemon) only supports local connections for now, that means that you just can connect through your localhost. You can't connect through a dns or try to connect to a [daemon](https://github.com/FleekHQ/space-daemon) running on a different machine.\n\n```js\n  import { SpaceClient } from '@fleekhq/space-client';\n\n  // default port exposed by the daemon for client connection is 9998\n  const client = new SpaceClient({\n    url: `http://0.0.0.0:9998`,\n  });\n\n  ...\n```\n\nIf you are running the client on the server-side, you need to declare `XMLHttpRequest` module as global. (this is because client is based on [grpc-web](https://www.npmjs.com/package/grpc-web), which is supposed to be used on client-side).\n\ninstall `XMLHttpRequest`\n\n```bash\n  yarn add xmlhttprequest\n```\n\nOr using npm\n\n```bash\n  npm install xmlhttprequest\n```\n\n\nthen to initialize the client:\n\n```js\n  global.XMLHttpRequest = require(\"xmlhttprequest\").XMLHttpRequest;\n\n  const { SpaceClient } = require('@fleekhq/space-client');\n\n  // default port exposed by the daemon for client connection is 9998\n  const client = new SpaceClient({\n    url: `http://0.0.0.0:9998`,\n  });\n\n  ...\n```\n\n## Generate Protobuf Messages and Client Service Stub\n\n### Step 1: Download the binary tools required to generate protobuf messages and client services:\n\n\u003e if you already have the tools, you can skip this step\n\nIn order to generate the Protobuf Messages and Client Service Stub you need:\n- `protoc` binary\n- `protoc-gen-grpc-web` plugin\n\n#### Install `protoc`\nGo to the latest release page of protobuf and download the binary for your OS: https://github.com/protocolbuffers/protobuf/releases\n\nIn this example we are going to use OSX, so the file that we need is `protoc-3.13.0-osx-x86_64.zip` (https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protoc-3.13.0-osx-x86_64.zip)\n\nUnzip the file, rename the uncompressed file to `protoc` and move it to the `bin` directory on your OS (make sure to change the permissions of the file):\n\n```bash\n$ sudo mv ~/Downloads/protoc /usr/local/bin/\n$ sudo chmod 777 /usr/local/bin/protoc\n```\n\n#### Install `protoc-gen-grpc-web`\nGo to the latest release page of grpc-web and download the binary for your OS: https://github.com/grpc/grpc-web/releases\n\nIn this example we are going to use OSX, so the file that we need is `protoc-gen-grpc-web-1.2.1-darwin-x86_64` (https://github.com/grpc/grpc-web/releases/download/1.2.1/protoc-gen-grpc-web-1.2.1-darwin-x86_64)\n\nRename the file to `protoc-gen-grpc-web` and move it to the `bin` directory on your OS (make sure to change the permissions of the file):\n\n```bash\n$ sudo mv ~/Downloads/protoc-gen-grpc-web /usr/local/bin/\n$ sudo chmod 777 /usr/local/bin/protoc-gen-grpc-web\n```\n\n\n### Step 2: Prepare the `space.proto` file\nDownload the latest version of the `space.proto` from `master` branch: https://github.com/FleekHQ/space-daemon/blob/master/grpc/proto/space.proto\n\nIf you need to update the `space.proto` from the `develop` branch, you can go to: https://github.com/FleekHQ/space-daemon/blob/develop/grpc/proto/space.proto\n\nDownload the `space.proto` into `/src/definitions/space.proto` on this project\n\nThen, using a text editor that supports regex (like vscode), open the space.proto and find by the following regex:\n\n```\n(import \"google/api/annotations.proto\";|(option \\(google.api.http\\) = \\{(\\n){0,1}(.*: .*|\\n)*.*\\};))\n```\n\nremove all the coincidences, and save the file:\n\n![example](https://gpuente-team-bucket.storage.fleek.co/2020-11-04%2016.54.11.gif)\n\n\n### Step 3: Generate Protobuf Messages and Client Service Stub\n\nOpen a terminal and move into the definitions folder:\n\n```bash\ncd src/definitions\n```\n\nthen execute the following command:\n\n```bash\nprotoc -I=. space.proto \\\n  --js_out=import_style=commonjs:. \\\n  --grpc-web_out=import_style=typescript,mode=grpcwebtext:.\n```\n\nthe command is going to generate 3 files: `space_pb.d.ts`, `space_pb.js` and `SpaceServiceClientPb.ts`\n\n\n### Step 4: Test the build\nOnce you successfully generated the protobuf messages and the client service stub, you have to test that the build is passing with this new version of the `space.proto`:\n\n```bash\nyarn build\n```\n\nIf the build fails, means that you have to update `src/client.ts` file with the latest versions of the types generated.\n\n\n## API\n\n### App Token Authorization\n\nSpace Daemon uses a token mechanism to prevent unauthorized clients from calling its methods, as otherwise user keys and files would be exposed.\n\nWhen using a fresh instance of the daemon where no tokens have been generated, it is possible to call the `InitializeMasterAppToken` method, which generates a fully authorized token (it has permission to call any space-daemon method). This token must be sent through the metadata argument on each subsequent call, otherwise the daemon will return an authorization error.\n\nIf you want to grant third-party apps access to a subset of methods after the master token was already generated, space-daemon provides the `GenerateAppToken` method. (WIP. will soon be implemented).\n\n#### App Token Authorization Example\n\n```javascript\nconst initializeMasterAppTokenRes = await client.initializeMasterAppToken();\nconst token = initializeMasterAppTokenRes.getApptoken();\n\n// token should be stored for later usage...\n\n// The authorized call\nawait client.openFile(\n  {path: \"some/path\"},\n  {\n    metadata: {\n      authorization: `AppToken ${token}`,\n    },\n  },\n)\n```\n\n### Space Client API methods\n\n#### class SpaceClient(opts)\n\nUse this class to create space client instances able to interact with space-daemon\n\nOptions:\n\n- `opts.url`: \u003cem\u003e**(string, required)**\u003c/em\u003e space dameon url + port (`https://0.0.0.0:9998`)\n- `opts.defaultBucket?`: \u003cem\u003e**(string, optional)**\u003c/em\u003e change the default bucket. This value is used when you don't pass the bucket param on some of the methods below. if you don't pass this property, `personal` bucket is going to be used as default value (`personal` bucket is created by default when you run space-daemon for the first time).\n- `opts.options?`: \u003cem\u003e**(object, optional)**\u003c/em\u003e [grpc-web](https://github.com/grpc/grpc-web) client options.\n- `opts.credentials?`: \u003cem\u003e**(object, optional)**\u003c/em\u003e [grpc-web](https://github.com/grpc/grpc-web) client credentials.\n\n\n```js\nimport { SpaceClient } from '@fleekhq/space-client';\n\nconst opts = {\n  url: 'http://0.0.0.0:9998',\n  defaultBucket: 'my-bucket',\n};\n\nconst client = new SpaceClient(opts);\n```\n\n#### .listDirectory({ path: string, bucket?: string })\n\nReturns the folder or files in the path directory.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n\n```js\n  client\n    .listDirectory({ path: '/', bucket: 'my-bucket' })\n    .then((res) =\u003e {\n      const entries = res.getEntriesList();\n\n      entries.forEach((entry) =\u003e {\n        console.log(entry.getPath());\n        console.log(entry.getName());\n        console.log(entry.getIsdir());\n        console.log(entry.getCreated());\n        console.log(entry.getUpdated());\n        console.log(entry.getIpfshash());\n        console.log(entry.getSizeinbytes());\n        console.log(entry.getFileextension());\n        console.log(entry.getIslocallyavailable());\n        console.log(entry.getBackupcount());\n        console.log(entry.getMembersList());\n      });\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.listDirectory({ path: '/', bucket: 'my-bucket' });\n    const entries = res.getEntriesList();\n\n    entries.forEach((entry) =\u003e {\n      ...\n    });\n  };\n```\n\n#### .listDirectories({ bucket?: string })\n\nReturns a Promise that resolves to an array of Directories representing all the folders and files inside the bucket.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  client\n    .listDirectories({ bucket: 'my-bucket' })\n    .then((res) =\u003e {\n      const entries = res.getEntriesList();\n\n      entries.forEach((entry) =\u003e {\n        console.log(entry.getPath());\n        console.log(entry.getName());\n        console.log(entry.getIsdir());\n        console.log(entry.getCreated());\n        console.log(entry.getUpdated());\n        console.log(entry.getIpfshash());\n        console.log(entry.getSizeinbytes());\n        console.log(entry.getFileextension());\n        console.log(entry.getIslocallyavailable());\n        console.log(entry.getBackupcount());\n        console.log(entry.getMembersList());\n      });\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.listDirectories({ bucket: 'my-bucket' });\n    const entries = res.getEntriesList();\n\n    entries.forEach((entry) =\u003e {\n      ...\n    });\n  };\n```\n\n#### .txlSubscribe()\n\nReturns a ReadableStream that notifies when something changed on the bucket (data stream returns the Bucket name).\n\n```js\n  const txlStream = client.txlSubscribe();\n\n  txlStream.on('data', (res) =\u003e {\n    const bucket = res.getBucket();\n    console.log(bucket);\n  });\n```\n\n#### .fileInfoSubscribe()\n\nReturns a ReadableStream that notifies when a change related to the a file has occured such as the amount of members the file is shared with or whether the file is backup in Space.\n\n```js\n  const fileInfoStream = client.fileInfoSubscribe();\n\n  fileInfoStream.on('data', (res) =\u003e {\n    const file = res.getFile();\n    console.log(file);\n  });\n```\n\n#### .openFile({ path: string, bucket?: string. dbId?: string })\n\nCopies the file referenced by the path arg to a temp folder and returns a Promise that resolves to the file location.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n`dbId` should be used to open shared files. (you can get the `dbId` from `getSharedWithMeFiles` method).\n\n```js\nconst asyncFunc = async () =\u003e {\n  const bucket = 'my-bucket';\n\n  const dirRes = await client.listDirectories({\n    bucket,\n  });\n\n  const entriesList = dirRes.getEntriesList();\n\n  const openFileRes = await client.openFile({\n    bucket,\n    path: entriesList[0].getPath(),\n  });\n\n  const location = openFileRes.getLocation();\n  console.log(location); // \"/path/to/the/copied/file\"\n};\n```\n\n#### .createBucket({ slug: string })\n\nCreates a new bucket. Returns a Promise that resolves to the new bucket\n\n```js\n  client\n    .createBucket('myNewBucket')\n    .then((res) =\u003e {\n      const bucket = res.getBucket();\n\n      console.log(bucket.getKey());\n      console.log(bucket.getName());\n      console.log(bucket.getPath());\n      console.log(bucket.getCreatedat());\n      console.log(bucket.getUpdatedat());\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.createBucket('myNewBucket');\n    const bucket = res.getBucket();\n\n    console.log(bucket.getName());\n    ...\n  };\n```\n\n#### .addItems({ bucket?: string, targetPath: string, sourcePaths: string[] })\n\nAdd new items. Returns a readable stream to resolves the new items.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  const stream = client.addItems({\n    bucket: 'my-bucket',\n    targetPath: '/',\n    sourcePaths: ['/path-to-my-folder-or-file-to-upload']\n  });\n\n  stream.on('data', (data) =\u003e {\n    console.log('data: ', data);\n  });\n\n  stream.on('error', (error) =\u003e {\n    console.error('error: ', error);\n  });\n\n  stream.on('end', () =\u003e {\n    console.log('end');\n  });\n```\n\n#### .createFolder({ path: string, bucket?: string })\n\nCreates a new empty folder. Returns a Promise that resolves to the new folder.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  client\n    .createFolder({ path: '/', bucket: 'my-bucket' })\n    .then(() =\u003e {\n      console.log('folder created in path \"/\"');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.createFolder({ path: '/', bucket: 'my-bucket' });\n  };\n```\n\n#### .removeDirOrFile({ path: string, bucket?: string })\n\nRemoves a file or a folder and its content. \nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  client\n    .removeDirOrFile({ path: '/', bucket: 'my-bucket' })\n    .then(() =\u003e {\n      console.log('Deleted file or folder');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.removeDirOrFile({ path: '/', bucket: 'my-bucket' });\n  };\n```\n\n#### `[WIP]` \u003cem\u003e.toggleBucketBackup({ bucket: string, backup: boolean }) \u003c/em\u003e\n\nToggles whether or not to back up the content of a bucket to Space.\n\n```js\n  client\n    .toggleBucketBackup({ bucket: 'bucket-name', backup: true })\n    .then(() =\u003e {\n      console.log('bucket-name is backed up in Space!');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.toggleBucketBackup({ bucket: 'bucket-name', backup: true });\n  };\n```\n\n#### .backupKeysByPassphrase({ uuid: string, passphrase: string, type: number })\n\nBackup keys by a passphrase\n\n```js\n  client\n    .backupKeysByPassphrase({\n      type: 0, // 0 = PASSWORD; 1 = GOOGLE; 2 = TWITTER; 3 = EMAIL\n      uuid: 'user-uuid',\n      passphrase: 'my-passphrase',\n    })\n    .then(() =\u003e {\n      console.log('keys backup');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.backupKeysByPassphrase({\n      uuid: 'user-uuid',\n      passphrase: 'my-passphrase',\n      type: 0, // 0 = PASSWORD; 1 = GOOGLE; 2 = TWITTER; 3 = EMAIL\n    });\n  };\n```\n\n#### .recoverKeysByPassphrase({ uuid: string, passphrase: string, type: number })\n\nRecovery keys by passphrase\n\n```js\n  client\n    .recoverKeysByPassphrase({\n      type: 0, // 0 = PASSWORD; 1 = GOOGLE; 2 = TWITTER; 3 = EMAIL\n      uuid: 'user-uuid',\n      passphrase: 'my-passphrase',\n    })\n    .then(() =\u003e {\n      console.log('recovery keys');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.recoverKeysByPassphrase({\n      type: 0, // 0 = PASSWORD; 1 = GOOGLE; 2 = TWITTER; 3 = EMAIL\n      uuid: 'user-uuid',\n      passphrase: 'my-passphrase',\n    });\n  };\n```\n\n#### .testKeysPassphrase({ uuid: string, passphrase: string })\n\nTest keys with passphrase\n\n```js\n  client\n    .testKeysPassphrase({\n      uuid: 'user-uuid',\n      passphrase: 'my-passphrase',\n    })\n    .then(() =\u003e {\n      console.log('test success');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.testKeysPassphrase({\n      uuid: 'user-uuid',\n      passphrase: 'my-passphrase',\n    });\n  };\n```\n\n#### .generateKeyPairWithForce()\n\nGenerate key pair with force\n\n```js\n  client\n    .generateKeyPairWithForce()\n    .then(() =\u003e {\n      console.log('keys generated');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.generateKeyPairWithForce();\n  };\n```\n\n#### `[WIP]` \u003cem\u003e.toggleFuseDrive({ mountDrive: boolean })\u003c/em\u003e\n\u003e this method is still not supported by [space-daemon](https://github.com/FleekHQ/space-daemon)\n\nFuse Status:\n```protobuf\nenum FuseState {\n  UNSUPPORTED = 0;\n  NOT_INSTALLED = 1;\n  UNMOUNTED = 2;\n  MOUNTED = 3;\n}\n```\n\nToggle Fuse drive\n\n```js\n  client\n    .toggleFuseDrive({\n      mountDrive: true || false,\n    })\n    .then((res) =\u003e {\n      console.log(res.getState());\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.toggleFuseDrive({\n      mountDrive: true || false,\n    });\n\n    console.log(res.getFusedrivemounted());\n  };\n```\n\n#### `[WIP]` \u003cem\u003e.getFuseDriveStatus({})\u003c/em\u003e\n\u003e this method is still not supported by [space-daemon](https://github.com/FleekHQ/space-daemon)\n\nFuse Status:\n```protobuf\nenum FuseState {\n  UNSUPPORTED = 0;\n  NOT_INSTALLED = 1;\n  UNMOUNTED = 2;\n  MOUNTED = 3;\n}\n```\n\nGet Fuse drive status\n\n```js\n  client\n    .getFuseDriveStatus({})\n    .then((res) =\u003e {\n      console.log(res.getState());\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getFuseDriveStatus({});\n\n    console.log(res.getFusedrivemounted());\n  };\n```\n\n#### .subscribe()\n\nReturns a ReadableStream that notifies when something changed on the bucket (data stream returns the event type + the entry affected).\nEvent type can be one of:\n\n```protobuf\n  enum EventType {\n    ENTRY_ADDED = 0;\n    ENTRY_DELETED = 1;\n    ENTRY_UPDATED = 2;\n    ENTRY_BACKUP_IN_PROGRESS = 3;\n    ENTRY_BACKUP_READY = 4;\n    ENTRY_RESTORE_IN_PROGRESS = 5;\n    ENTRY_RESTORE_READY = 6;\n    FOLDER_ADDED = 7;\n    FOLDER_DELETED = 8;\n    FOLDER_UPDATED = 9;\n  }\n```\n\nexample:\n```js\n  const subscribeStream = client.subscribe();\n\n  subscribeStream.on('data', (res) =\u003e {\n    const eventType = res.getType();\n    const entry = res.getEntry();\n    const bucket = res.getBucket();\n    const dbId = res.getDbid();\n\n    console.log('subscribe data:', {\n      dbId,\n      bucket,\n      eventType: eventType.toString(),\n      path: entry.getPath(),\n      name: entry.getName(),\n      isDir: entry.getIsdir(),\n      created: entry.getCreated(),\n      updated: entry.getUpdated(),\n      ipfsHash: entry.getIpfshash(),\n      sizeInBytes: entry.getSizeinbytes(),\n      fileExtension: entry.getFileextension(),\n    });\n```\n\n#### `[WIP]` \u003cem\u003e.listBuckets()\u003c/em\u003e\n\n\u003e this method is still not supported by [space-daemon](https://github.com/FleekHQ/space-daemon)\n\nReturns all the buckets available\n\n```js\n  client\n    .listBuckets()\n    .then((res) =\u003e {\n      const buckets = res.getBucketsList();\n\n      buckets.forEach((bucket) =\u003e {\n        console.log('key:', bucket.getKey());\n        console.log('name:', bucket.getName());\n        console.log('path:', bucket.getPath());\n        console.log('createdAt:', bucket.getCreatedat());\n        console.log('updatedAt:', bucket.getUpdatedat());\n      });\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.listBuckets();\n    const buckets = res.getBucketsList();\n\n    ...\n  };\n```\n\n\n#### .shareBucket({ bucket?: string })\n\nShares a bucket. Returns a promis that resolves to the threadInfo (required to join a bucket).\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  client\n    .shareBucket({ bucket: 'my-bucket' })\n    .then((res) =\u003e {\n      const threadInfo = res.getThreadinfo();\n\n      console.log('key:', threadInfo.getKey());\n      console.log('addresses:', threadInfo.getAddressesList());\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.shareBucket({ bucket: 'my-bucket' });\n    const threadInfo = res.getThreadinfo();\n\n    ...\n  };\n```\n\n\n\n#### .joinBucket({ bucket: string?, threadInfo: { key: string, addresses: [string] } })\n\nJoins a shared bucket.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  client\n    .joinBucket({\n      bucket: 'my-bucket',\n      threadInfo: {\n        key: 'my-key',\n        addresses: ['address1', 'address2', 'address3'],\n      },\n    })\n    .then((res) =\u003e {\n      console.log('result', res.getResult());\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.joinBucket({\n      bucket: 'my-bucket',\n      threadInfo: {\n        key: 'my-key',\n        addresses: ['address1', 'address2', 'address3'],\n      },\n    });\n\n    console.log('result', res.getResult());\n\n    ...\n  };\n```\n\n#### .getPublicKey()\n\nGet the current public key generated by the daemon and the hub auth token.\n\n```js\n  client\n    .getPublicKey()\n    .then((res) =\u003e {\n      const publicKey = res.getPublickey();\n      const hubAuthToken = res.getHubauthtoken();\n\n      console.log('publicKey', publicKey);\n      console.log('hubAuthToken', hubAuthToken);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getPublicKey();\n\n    console.log('publicKey', res.getPublickey());\n    console.log('hubAuthToken', res.getHubauthtoken());\n\n    ...\n  };\n```\n\n#### .notificationSubscribe()\nReturns a ReadableStream that notifies about new notifications.\nNotifications are triggered upon another member's interaction with a shared file or bucket, for example if he attempts to add a new file to a shared bucket.\n\n```js\n  const notificationStream = client.notificationSubscribe();\n\n  notificationStream.on('data', (res) =\u003e {\n    const notification = res.getNotification();\n    console.log(notification);\n  });\n```\n\n#### .readNotification({ ID: string })\n\nMark a notification as read.\n\n```js\n  client\n    .readNotifcation({ ID: '1234' })\n    .then(() =\u003e {\n      console.log('notifcation was marked as read');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.readNotification({ ID: '1234' });\n\n    console.log('notifcation was marked as read');\n    ...\n  };\n```\n\n#### .getNotifications({ seek: string, limit: number })\nReturns a list of notifications objects. Notifications objects represent just share file invitations for now.\n\n```js\n  client\n    .getNotifications({ seek: 'some-value', limit: 20 })\n    .then((res) =\u003e {\n      const objectRes = {\n        nextOffset: res.getNextoffset(),\n        notifications: res.getNotificationsList().map((notification) =\u003e ({\n          id: notification.getId(),\n          body: notification.getBody(),\n          type: notification.getType(),\n          readAt: notification.getReadat(),\n          subject: notification.getSubject(),\n          createdAt: notification.getCreatedat(),\n          relatedObject: notification.getRelatedobjectCase(),\n        })),\n      };\n\n      console.log(objectRes);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getNotifications({ seek: 'some-value', limit: 20 });\n\n    console.log(res);\n    ...\n  };\n```\n\n#### .handleFilesInvitation({ invitationID: string, accept: boolean })\n\nThis method is for accepting or rejecting an invitation to a sharing request of a file.\n\n```js\n  client\n    .handleFilesInvitation({ invitationID: '123-123-123', accept: true })\n    .then((response) =\u003e {\n      console.log(response);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n\n    await client.handleFilesInvitation({ invitationID: '123-123-123', accept: true });\n    ...\n  };\n```\n\n#### .setNotificationsLastSeenAt({ timestamp: number })\nUpdates the timestamp which is returned by the `getNotifications()` method through calling `getLastseenat()`.\nThis timestamp can be used to track which notification has not yet been seen by the user.\n\n```js\n  client\n    .setNotificationsLastSeenAt({ timestamp: 1598889151456 })\n    .then(() =\u003e {\n      console.log('Updated the notifications timestamp');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.setNotificationsLastSeenAt({ timestamp: 1598889151456 });\n    ...\n  };\n```\n\n#### .deleteAccount()\n\nDelete an account.\n\n```js\n  client.deleteAccount().then((res) =\u003e {\n    console.log('account delted');\n  })\n  .catch((err) =\u003e {\n    console.error(err);\n  });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.deleteAccount();\n\n    console.log('account delted');\n  };\n```\n\n#### .deleteKeyPair()\n\nDeletes the Key Pair\n\n```js\n  client\n    .deleteKeyPair()\n    .then((res) =\u003e {\n      console.log(res);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.deleteKeyPair();\n\n    console.log(res);\n    ...\n  };\n```\n\n#### .getUsageInfo()\n\nFetches account storage usage info such as amount of space used locally and in Space, alongside bandwith quotas and limits.\n\n```js\n  client\n    .getUsageInfo()\n    .then((usageInfoRes) =\u003e {\n      const usageInfo = {\n        localstorageused: usageInfoRes.getLocalstorageused(),\n        localbandwidthused: usageInfoRes.getLocalbandwidthused(),\n        spacestorageused: usageInfoRes.getSpacestorageused(),\n        spacebandwidthused: usageInfoRes.getSpacebandwidthused(),\n        usagequota: usageInfoRes.getUsagequota(),\n      }\n\n      console.log(usageInfo);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const usageInfoRes = await client.getUsageInfo();\n\n    const usageInfo = {\n      localstorageused: usageInfoRes.getLocalstorageused(),\n      localbandwidthused: usageInfoRes.getLocalbandwidthused(),\n      spacestorageused: usageInfoRes.getSpacestorageused(),\n      spacebandwidthused: usageInfoRes.getSpacebandwidthused(),\n      usagequota: usageInfoRes.getUsagequota(),\n    }\n\n    console.log(usageInfo);\n    ...\n  };\n```\n\n#### .getStoredMnemonic()\n\nGet the stored mnemonic seed.\n\n```js\n  client\n    .getStoredMnemonic()\n    .then((res) =\u003e {\n      console.log(res.getMnemonic());\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getMnemonic();\n\n    console.log(res.getMnemonic());\n    ...\n  };\n```\n\n#### .restoreKeyPairViaMnemonic({ mnemonic: string })\n\nRestore key pair via mnemonic\n\n```js\n  client\n    .restoreKeyPairViaMnemonic({\n      mnemonic: 'my-mnemonic',\n    })\n    .then(() =\u003e {\n      console.log('restore keys');\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    await client.restoreKeyPairViaMnemonic({\n      mnemonic: 'my-mnemonic',\n    });\n  };\n```\n\n\n#### .getSharedWithMeFiles({ seek: string, limit: number })\n\nReturns the list of files shared with me\n\n```js\n  client\n    .getSharedWithMeFiles({\n      seek: \"seek_value\",\n      limit: 30,\n    })\n    .then((res) =\u003e {\n      const result = {\n        nextOffset: result.getNextoffset(),\n        items: result.getItemsList().map((item) =\u003e {\n          const entry = item.getEntry();\n\n          return {\n            dbId: item.getDbid(),\n            bucket: item.getBucket(),\n            path: entry.getEntrygetPath(),\n            isDir: entry.getIsdir(),\n            name: entry.getName(),\n            sizeInBytes: entry.getSizeinbytes(),\n            created: entry.getCreated(),\n            updated: entry.getUpdated(),\n            fileExtension: entry.getFileextension(),\n            ipfsHash: entry.getIpfshash(),\n            isLocallyAvailable: entry.getIslocallyavailable(),\n            backupCount: entry.getBackupcount(),\n            members: entry.getMembersList().map((member) =\u003e ({\n              publicKey: member.getPublickey(),\n            })),\n          };\n        }),\n      };\n\n      console.log(result);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getSharedWithMeFiles({\n      seek: \"seek_value\",\n      limit: 30,\n    });\n\n    console.log(res.getItemsList());\n    ...\n  };\n```\n\n\n#### .shareFilesViaPublicKey({ publicKeys: [string], paths: [{ dbId?: string, bucket?: string, path: string }] })\n\nShare files with other users via their public keys\n\n```js\n  client\n    .shareFilesViaPublicKey({\n      publicKeys: ['pubKey1', 'pubKey2', 'pubKey3'],\n      paths: [{\n        path: 'path1/file.jpeg',\n        dbId: 'db-id-1',\n        bucket: 'my-bucket',\n      }],\n    })\n    .then((res) =\u003e {\n      console.log(res);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.shareFilesViaPublicKey({\n      publicKeys: ['pubKey1', 'pubKey2', 'pubKey3'],\n      paths: [{\n        path: 'path1/file.jpeg',\n        dbId: 'db-id-1',\n        bucket: 'my-bucket',\n      }],\n    });\n\n    console.log(res);\n    ...\n  };\n```\n\n#### .getAPISessionTokens()\n\nGet the current api session tokens.\n\n```js\n  client\n    .getAPISessionTokens()\n    .then((res) =\u003e {\n      const hubToken = res.getHubtoken();\n      const servicestoken = res.getServicestoken();\n\n      console.log('hubToken', hubToken);\n      console.log('servicestoken', servicestoken);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getAPISessionTokens();\n\n    console.log('hubToken', res.getHubtoken());\n    console.log('servicestoken', res.getServicestoken());\n\n    ...\n  };\n```\n\n\n#### .getRecentlySharedWith()\n\nReturns a list of the recently members that you shared with\n\n```js\n  client\n    .getRecentlySharedWith()\n    .then((res) =\u003e {\n      const membersList = res.getMembersList();\n\n      const members = membersList.map((member) =\u003e ({\n        address: member.getAddress(),\n        publicKey: member.getPublickey(),\n      }));\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getRecentlySharedWith();\n\n    const membersList = res.getMembersList();\n    ...\n  };\n```\n\n\n#### .generatePublicFileLink({ bucket?: string, password: string, itemPaths: [string], dbId: string })\n\nGenerates a sharing public link for the files specified.\nIf you don't specify the `bucket` property, `client.defaultBucket` value is going to be used instead.\n\n```js\n  client\n    .generatePublicFileLink({\n      dbId: 'db-id-string',\n      bucket: 'my-bucket',\n      password: '123asd',\n      itemPaths: ['path/to/file1.txt', 'path/to/file2.txt'],\n    })\n    .then((res) =\u003e {\n      const fileInfo = {\n        link: res.getLink(),\n        fileCid: res.getFilecid(),\n      };\n\n      console.log(fileInfo);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.generatePublicFileLink({\n      bucket: 'my-bucket',\n      password: '123asd',\n      itemPaths: ['path/to/file1.txt', 'path/to/file2.txt'],\n    });\n\n    const fileInfo = {\n      link: res.getLink(),\n      fileCid: res.getFilecid(),\n    };\n\n    ...\n  };\n```\n\n#### .openPublicFile({ fileCid: string, password: string, filename: string })\n\nOpen a file from a shared public link.\n\n```js\n  client\n    .openPublicFile({\n      fileCid: 'some-id',\n      password: 'file-password',\n      filename: 'some-filename',\n    })\n    .then((res) =\u003e {\n      const location = res.getLocation();\n\n      console.log(location);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.openPublicFile({\n      fileCid: 'some-id',\n      fileKey: 'some-password',\n      filename: 'some-filename',\n    });\n\n    res.getLocation()\n\n    ...\n  };\n```\n\n\n#### .searchFiles({ query: string })\n\nSearch files/folder by name. Returns an EntryList with the results.\n\n```js\n  client\n    .searchFiles({\n      query: 'filename',\n    })\n    .then((res) =\u003e {\n      const entriesList = res.getEntriesList();\n\n      const entries = entriesList.map((item) =\u003e {\n        const dbId = item.getDbid();\n        const entry = item.getEntry();\n        const bucket = item.getBucket();\n\n        return {\n          dbId,\n          bucket,\n          path: entry.getPath(),\n          name: entry.getName(),\n          isDir: entry.getIsdir(),\n          created: entry.getCreated(),\n          updated: entry.getUpdated(),\n          ipfsHash: entry.getIpfshash(),\n          sizeInBytes: entry.getSizeinbytes(),\n          fileExtension: entry.getFileextension(),\n          isLocallyAvailable: entry.getIslocallyavailable(),\n          backupCount: entry.getBackupcount(),\n          members: entry.getMembersList()\n        };\n      });\n\n      console.log('entries res:', entries);\n    })\n    .catch((error) =\u003e {\n      console.error(error);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.searchFiles({ query: 'filename' });\n\n    const entriesList = res.getEntriesList();\n\n    ...\n  };\n\n```\n\n#### .getSharedWithMeFiles({ seek: string, limit: number })\n\nReturns the list of files shared with me\n\n```js\n  client\n    .getSharedWithMeFiles({\n      seek: \"seek_value\",\n      limit: 30,\n    })\n    .then((res) =\u003e {\n      const result = {\n        nextOffset: result.getNextoffset(),\n        items: result.getItemsList().map((item) =\u003e {\n          const entry = item.getEntry();\n\n          return {\n            dbId: item.getDbid(),\n            bucket: item.getBucket(),\n            path: entry.getEntrygetPath(),\n            isDir: entry.getIsdir(),\n            name: entry.getName(),\n            sizeInBytes: entry.getSizeinbytes(),\n            created: entry.getCreated(),\n            updated: entry.getUpdated(),\n            fileExtension: entry.getFileextension(),\n            ipfsHash: entry.getIpfshash(),\n            isLocallyAvailable: entry.getIslocallyavailable(),\n            backupCount: entry.getBackupcount(),\n            members: entry.getMembersList().map((member) =\u003e ({\n              publicKey: member.getPublickey(),\n            })),\n          };\n        }),\n      };\n\n      console.log(result);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getSharedWithMeFiles({\n      seek: \"seek_value\",\n      limit: 30,\n    });\n\n    console.log(res.getItemsList());\n    ...\n  };\n```\n\n#### .initializeMasterAppToken()\n\nInitializes the daemon with a master app token. This token is required in following requests otherwise they will fail with an unauthorized error. If the daemon already has a master app token, this call will throw.\n\n```js\n  client\n    .initializeMasterAppToken()\n    .then((res) =\u003e {\n      const token = res.getApptoken();\n\n      console.log('token:', token);\n    })\n    .catch((error) =\u003e {\n      console.error(error);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.initializeMasterAppToken();\n\n    const token = res.getApptoken();\n\n    ...\n  };\n\n```\n\n#### .getSharedByMeFiles({ seek: string, limit: number })\n\nReturns the list of files shared by me\n\n```js\n  client\n    .getSharedByMeFiles({\n      seek: \"seek_value\",\n      limit: 30,\n    })\n    .then((res) =\u003e {\n      const result = {\n        nextOffset: result.getNextoffset(),\n        items: result.getItemsList().map((item) =\u003e {\n          const entry = item.getEntry();\n\n          return {\n            dbId: item.getDbid(),\n            bucket: item.getBucket(),\n            path: entry.getEntrygetPath(),\n            isDir: entry.getIsdir(),\n            name: entry.getName(),\n            sizeInBytes: entry.getSizeinbytes(),\n            created: entry.getCreated(),\n            updated: entry.getUpdated(),\n            fileExtension: entry.getFileextension(),\n            ipfsHash: entry.getIpfshash(),\n            isLocallyAvailable: entry.getIslocallyavailable(),\n            backupCount: entry.getBackupcount(),\n            members: entry.getMembersList().map((member) =\u003e ({\n              publicKey: member.getPublickey(),\n            })),\n          };\n        }),\n      };\n\n      console.log(result);\n    })\n    .catch((err) =\u003e {\n      console.error(err);\n    });\n\n  /* Or using Async/Await */\n\n  const asyncFunc = async () =\u003e {\n    const res = await client.getSharedByMeFiles({\n      seek: \"seek_value\",\n      limit: 30,\n    });\n\n    console.log(res.getItemsList());\n    ...\n  };\n```\n\n## Example\nYou can check the example included in the `example` folder.\n\nTo run the example you need to download and run the [daemon](https://github.com/FleekHQ/space-daemon#installation) first\n\nThen you can run the example by\n\n```bash\n  npm run example\n```\n\nthen on your web browser go to `localhost:3001`\n\n## Proto File Reference\n\nIf you need more information about the available methods, you can check the [Proto File Schema](https://github.com/FleekHQ/space-client/blob/develop/src/definitions/space.proto).\n\n\n## Daemon\n\nYou can find more information related to the daemon [here](https://github.com/FleekHQ/space-daemon)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffleekhq%2Fspace-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffleekhq%2Fspace-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffleekhq%2Fspace-client/lists"}