WebHareBlob | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Class WebHareBlobAbstract

    Interface to streamable binary buffers that may come from eg. disk, memory or database

    Implements

    • Blob
    Index

    Constructors

    • Parameters

      • size: number
      • type: string

      Returns WebHareBlob

    Properties

    _path: string = ''

    Path if blob is on disk. Any WebHare blob can be serialized by a database upload and its path will then be updated to reflect this

    Accessors

    • get path(): string

      Returns string

    • get size(): number

      The size read-only property of the Blob interface returns the size of the Blob or File in bytes.

      MDN Reference

      Returns number

    • get type(): string

      The type read-only property of the Blob interface returns the MIME type of the file.

      MDN Reference

      Returns string

    Methods

    • Returns Readonly<Uint8Array<ArrayBuffer>>

    • Get the blob contents as an ArrayBuffer. You should be careful with this API on large blobs (especially 10MB and above) as they will be fully loaded into the JavaScript heap and may cause memory pressure.

      Returns Promise<ArrayBuffer>

    • The bytes() method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.

      MDN Reference

      Returns Promise<Uint8Array<ArrayBuffer>>

    • Returns Promise<ReadableStream<Uint8Array<ArrayBuffer>>>

      Use stream() instead

    • Parameters

      • path: string

      Returns void

    • The slice() method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.

      MDN Reference

      Parameters

      • Optionalstart: number
      • Optionalend: number
      • OptionalcontentType: string

      Returns Blob

    • The stream() method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.

      MDN Reference

      Returns ReadableStream<Uint8Array<ArrayBuffer>>

    • The text() method of the string containing the contents of the blob, interpreted as UTF-8.

      MDN Reference

      Returns Promise<string>

    • Create a in-memory WebHareBlob from a string or buffer

      Parameters

      • str:
            | string
            | ArrayBuffer
            | Buffer<ArrayBuffer>
            | Uint8Array<ArrayBuffer>
            | DataView<ArrayBuffer>
            | ArrayBufferView<ArrayBuffer>
      • __namedParameters: { type?: string } = {}

      Returns WebHareBlob

    • Create a WebHare blob from a JavaScript Blob, copying the data

      Parameters

      • blob: Blob
      • __namedParameters: { type?: string } = {}

      Returns Promise<WebHareBlob>

    • Create a WebHare blob from a file on disk

      Parameters

      • path: string

      Returns Promise<WebHareBlob>

    • Create a WebHare blob from a file on disk, given path and length, without checking if the file exists

      Parameters

      • path: string
      • len: number

      Returns WebHareBlob

    • Parameters

      • thingy: unknown

      Returns thingy is WebHareBlob