Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Storage

Index

Constructors

constructor

Properties

userSession

userSession: UserSession

Methods

deleteFile

  • deleteFile(path: string, options?: { wasSigned?: boolean }): Promise<void>
  • Deletes the specified file from the app's data store.

    Parameters

    • path: string

      The path to the file to delete.

    • Optional options: { wasSigned?: boolean }

      Optional options object.

      • Optional wasSigned?: boolean

        Set to true if the file was originally signed in order for the corresponding signature file to also be deleted.

    Returns Promise<void>

    Resolves when the file has been removed or rejects with an error.

getAppBucketUrl

  • getAppBucketUrl(gaiaHubUrl: string, appPrivateKey: string): Promise<string>
  • Get the app storage bucket URL

    Parameters

    • gaiaHubUrl: string

      the gaia hub URL

    • appPrivateKey: string

      the app private key used to generate the app address

    Returns Promise<string>

    That resolves to the URL of the app index file or rejects if it fails

getFile

  • getFile(path: string, options?: GetFileOptions): Promise<null | string | ArrayBuffer>
  • Retrieves the specified file from the app's data store.

    Parameters

    Returns Promise<null | string | ArrayBuffer>

    that resolves to the raw data in the file or rejects with an error

getFileContents

  • getFileContents(path: string, app: string, username: undefined | string, zoneFileLookupURL: undefined | string, forceText: boolean): Promise<null | string | ArrayBuffer>
  • Parameters

    • path: string
    • app: string
    • username: undefined | string
    • zoneFileLookupURL: undefined | string
    • forceText: boolean

    Returns Promise<null | string | ArrayBuffer>

getFileSignedUnencrypted

  • getFileSignedUnencrypted(path: string, opt: GetFileOptions): Promise<null | string | ArrayBuffer>
  • Parameters

    Returns Promise<null | string | ArrayBuffer>

getFileUrl

  • Get the URL for reading a file from an app's data store.

    Parameters

    Returns Promise<string>

    that resolves to the URL or rejects with an error

getGaiaAddress

  • getGaiaAddress(app: string, username?: string, zoneFileLookupURL?: string): Promise<string>
  • Parameters

    • app: string
    • Optional username: string
    • Optional zoneFileLookupURL: string

    Returns Promise<string>

getUserAppFileUrl

  • getUserAppFileUrl(path: string, username: string, appOrigin: string, zoneFileLookupURL?: string): Promise<undefined | string>
  • Fetch the public read URL of a user file for the specified app.

    Parameters

    • path: string

      the path to the file to read

    • username: string

      The Blockstack ID of the user to look up

    • appOrigin: string

      The app origin

    • Optional zoneFileLookupURL: string

    Returns Promise<undefined | string>

    that resolves to the public read URL of the file or rejects with an error

handleSignedEncryptedContents

  • handleSignedEncryptedContents(path: string, storedContents: string, app: string, privateKey?: string, username?: string, zoneFileLookupURL?: string): Promise<string | Buffer>
  • Parameters

    • path: string
    • storedContents: string
    • app: string
    • Optional privateKey: string
    • Optional username: string
    • Optional zoneFileLookupURL: string

    Returns Promise<string | Buffer>

listFiles

  • listFiles(callback: (name: string) => boolean): Promise<number>
  • List the set of files in this application's Gaia storage bucket.

    Parameters

    • callback: (name: string) => boolean

      a callback to invoke on each named file that returns true to continue the listing operation or false to end it. If the call is ended early by the callback, the last file is excluded. If an error occurs the entire call is rejected.

        • (name: string): boolean
        • Parameters

          • name: string

          Returns boolean

    Returns Promise<number>

    that resolves to the number of files listed

putFile

  • putFile(path: string, content: string | Buffer | Blob | ArrayBufferView, options?: PutFileOptions): Promise<string>
  • Stores the data provided in the app's data store to to the file specified.

    Parameters

    • path: string

      the path to store the data in

    • content: string | Buffer | Blob | ArrayBufferView

      the data to store in the file

    • Optional options: PutFileOptions

      a PutFileOptions object

    Returns Promise<string>

    that resolves if the operation succeed and rejects if it failed

Generated using TypeDoc