Options
All
  • Public
  • Public/Protected
  • All
Menu

Helper class for tracking intent when creating a File object for uploading

See examples at top of file

Hierarchy

Index

Constructors

  • new NodeFile(data?: any, fileFormat?: string, name?: string, createOpts?: {}, urlOpts?: string): NodeFile

Methods

  • createFile(client: ClientType, force?: boolean): Promise<any>
  • See examples at top of file

    Helper function to create the file on the server but not yet upload its data

    By default, this will skip recreating files that have already been created.

    Parameters

    • client: ClientType

      Client object to use for uploading

    • Optional force: boolean

      If true, will force creation of a new ID even if file has already been uploaded

    Returns Promise<any>

  • setData(data: any): void
  • See examples at top of file

    Populate data for later uploading if it wasn't set during construction

    Cannot run this function if the file has already been uploaded

    Overwrites any existing data

    Parameters

    • data: any

      Data to use for uploading

    Returns void

  • upload(client: ClientType, force?: boolean): Promise<File>
  • See examples at top of file

    Upload curent File object to the server

    By default, this will skip reuploading files that have already been uploaded.

    Parameters

    • client: ClientType

      Client object to use for uploading

    • Optional force: boolean

      If true, will force upload even if file has already been uploaded

    Returns Promise<File>

    Promise that resolves to the uploaded File object when it completes uploading

  • uploadData(client: ClientType, force?: boolean): Promise<any>
  • See examples at top of file

    Helper function to upload the data to the server

    By default, this will skip reuploading data that has already been uploaded.

    Parameters

    • client: ClientType

      Client object to use for uploading

    • Optional force: boolean

      If true, will force upload even if file has already been uploaded

    Returns Promise<any>

Properties

createOpts: Record<string, any>
fileFormat: string
name: string
type: FileType
uploadUrlOpts: string

Accessors

  • get data(): any
  • get fileCreateResponse(): any
  • get fileCreated(): boolean
  • get fileID(): undefined | string
  • get fileUploadResponse(): any
  • get fileUploaded(): any
  • get fileValidated(): any