NodeBlob

open class NodeBlob : BufferAPI.Blob, ProxyObject

Implements the Blob type from the Node.js buffer built-in module. Blobs are read-only chunks of byte data which can be used to derive buffers, strings, and other objects.

Inheritors

Constructors

Link copied to clipboard
constructor()

Creates a new empty buffer.

constructor(sources: PolyglotValue)

Creates a new buffer filled by concatenating the provider sources. The sources object must have array elements of a supported type, namely PolyglotValue.hasBufferElements, or objects with a buffer member with the same effect.

constructor(sources: PolyglotValue?, options: PolyglotValue?)

Creates a new buffer filled by concatenating the provider sources. The sources object must have array elements of a supported type, namely PolyglotValue.hasBufferElements, or objects with a buffer member with the same effect.

Properties

Link copied to clipboard
open override val size: Int

Size in bytes of this blob.

Link copied to clipboard
open override val type: String?

The content type of this Blob. Note that this value is informative only.

Functions

Link copied to clipboard
open override fun arrayBuffer(): JsPromise<PolyglotValue>

Returns a promise which resolves with a JavaScript ArrayBuffer object containing a copy of this blob's data.

Link copied to clipboard
open override fun getMember(key: String?): Any?
Link copied to clipboard
open override fun getMemberKeys(): Any
Link copied to clipboard
open override fun hasMember(key: String): Boolean
Link copied to clipboard
open override fun putMember(key: String?, value: PolyglotValue?)
Link copied to clipboard
open fun removeMember(key: String): Boolean
Link copied to clipboard
open override fun slice(start: Int?, end: Int?, type: String?): NodeBlob

Returns a copy of this blob between the requested indices, and optionally with a different type.

Link copied to clipboard
open override fun stream(): ReadableStream

Returns a stream that can be used to read the contents of this blob.

Link copied to clipboard
open override fun text(): JsPromise<String>

Returns a promise which resolves with the result of decoding this blob's data as a UTF-8 string.