API 参考

FBlob

本 API 页面目前提供英文正文。代码签名与标识符不随界面语言变化。

Access

Access through:

Setup

Register @univerjs/core or a preset that includes it. In plugin mode, import @univerjs/core/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs/core

FBlob.copyBlob

Returns a copy of this blob.

TypeScript
copyBlob(): FBlob

Returns

a new blob by copying the current blob

Examples

TypeScript
const blob = univerAPI.newBlob()const newBlob = blob.copyBlob()console.log(newBlob)

Types: FBlob

Package: @univerjs/core · Type definitions

FBlob.getAs

Return the data inside this object as a blob converted to the specified content type.

TypeScript
getAs(contentType: string): FBlob

Parameters

Returns

a new blob by converting the current blob to the specified content type

Examples

TypeScript
const blob = univerAPI.newBlob()const newBlob = blob.getAs('text/plain')console.log(newBlob)

Types: FBlob

Package: @univerjs/core · Type definitions

FBlob.getBytes

Gets the data stored in this blob.

TypeScript
getBytes(): Promise<Uint8Array>

Returns

the blob content as a byte array

Examples

TypeScript
const blob = univerAPI.newBlob()const bytes = await blob.getBytes()console.log(bytes)

Types: Uint8Array · Promise

Package: @univerjs/core · Type definitions

FBlob.getContentType

Gets the content type of the data stored in this blob.

TypeScript
getContentType(): string | undefined

Returns

the content type

Examples

TypeScript
const blob = univerAPI.newBlob()const contentType = blob.getContentType()console.log(contentType)

Package: @univerjs/core · Type definitions

FBlob.getDataAsString

Get the blob as a string.

TypeScript
getDataAsString(): Promise<string>getDataAsString(charset?: string): Promise<string>

Parameters

  • charset — Optional. the charset

Returns

the blob content as a string

Examples

TypeScript
const blob = univerAPI.newBlob()const data = await blob.getDataAsString()console.log(data)
TypeScript
const blob = univerAPI.newBlob()const data = await blob.getDataAsString('iso-8859-1')console.log(data)

Types: Promise

Package: @univerjs/core · Type definitions

FBlob.setBytes

Sets the data stored in this blob.

TypeScript
setBytes(bytes: Uint8Array): FBlob

Parameters

  • bytes — Required. a byte array

Returns

the blob object

Examples

TypeScript
const blob = univerAPI.newBlob()const bytes = new Uint8Array(10)blob.setBytes(bytes)

Types: FBlob · Uint8Array

Package: @univerjs/core · Type definitions

FBlob.setContentType

Sets the content type of the data stored in this blob.

TypeScript
setContentType(contentType: string): FBlob

Parameters

Returns

the blob object

Examples

TypeScript
const blob = univerAPI.newBlob()blob.setContentType('text/plain')

Types: FBlob

Package: @univerjs/core · Type definitions

FBlob.setDataFromString

Sets the data stored in this blob.

TypeScript
setDataFromString(data: string): FBlobsetDataFromString(data: string, contentType?: string): FBlob

Parameters

Returns

the blob object

Examples

TypeScript
const blob = univerAPI.newBlob()blob.setDataFromString('Hello, World!')
TypeScript
const blob = univerAPI.newBlob()blob.setDataFromString('Hello, World!', 'text/plain')

Types: FBlob

Package: @univerjs/core · Type definitions

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.