NodeFile

Implements the File class from the Node.js buffer built-in module. This class is basically a specialized NodeBlob with name and lastModified fields.

Constructors

Link copied to clipboard
constructor(sources: PolyglotValue, fileName: PolyglotValue)

Create a new NodeFile with the given sources and fileName, using default options. The sources value must have array elements of the supported type, meaning each item should either have buffer elements, or expose a buffer property that does. The fileName must be a string value.

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

Create a new NodeFile with the given sources, fileName, and options. The sources value must have array elements of the supported type, meaning each item should either have buffer elements, or expose a buffer property that does. The fileName must be a string value.

Properties

Link copied to clipboard
open override val lastModified: Long

An epoch timestamp indicating the last modification to this file.

Link copied to clipboard
open override val name: String

The name of the file.

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.