Hub JS Package

Hub JS Package

  • Users
  • Buckets
  • Threads
  • Textile Docs

›Buckets

Buckets

  • Buckets.copyAuth() method
  • Buckets.withUserAuth() method
  • Buckets.withKeyInfo() method
  • Buckets.getToken() method
  • Buckets.getTokenChallenge() method
  • Buckets.setToken() method
  • Buckets.withThread() method
  • Buckets.getOrCreate() method
  • Buckets.create() method
  • Buckets.existing() method
  • Buckets.root() method
  • Buckets.links() method
  • Buckets.list() method
  • Buckets.listPath() method
  • Buckets.listPathFlat() method
  • Buckets.listIpfsPath() method
  • Buckets.movePath() method
  • Buckets.open() method
  • Buckets.pushPath() method
  • Buckets.pushPaths() method
  • Buckets.pushPathAccessRoles() method
  • Buckets.pullPath() method
  • Buckets.pullPathAccessRoles() method
  • Buckets.pullIpfsPath() method
  • Buckets.remove() method
  • Buckets.removePath() method
  • Buckets.setPath() method

Experimental

  • Archive interface
  • ArchiveDealInfo interface
  • ArchiveStatus enum

Types

  • GetOrCreateOptions interface
  • GetOrCreateResponse interface
  • CreateOptions interface
  • CreateResponse interface
  • Links interface
  • Path interface
  • PathAccessRole enum
  • PathItem interface
  • Root interface
  • BuckMetadata interface

@textile/hub > Buckets > getOrCreate

Buckets.getOrCreate() method

Open a new / existing bucket by bucket name and ThreadID (create not required) Replaces open command in older versions.

Signature:

getOrCreate(name: string, options?: GetOrCreateOptions): Promise<GetOrCreateResponse>;

Parameters

ParameterTypeDescription
namestringname of bucket
optionsGetOrCreateOptions

Returns:

Promise<GetOrCreateResponse>

Remarks

The IPFS protocol and its implementations are still in heavy development. By using Textile, you are acknowledging that you understand there may be risks to storing your content on or using decentralized storage services.

Example

Create a Bucket called "app-name-files"

import { Buckets, UserAuth } from '@textile/hub'

const open = async (auth: UserAuth, name: string) => {
    const buckets = Buckets.withUserAuth(auth)
    const { root, threadID } = await buckets.getOrCreate(name)
    return { buckets, root, threadID }
}

← Buckets.withThread() methodBuckets.create() method →
  • Buckets.getOrCreate() method
  • Parameters
  • Remarks
  • Example
Hub JS Package
Docs
Getting StartedThreadDBBuckets
Resources
All DocumentationProject SlackBlog
More
GitHubStar
Follow @textileio