@univerjscoreclassesFblob

@univerjs/core v0.5.4


Class: FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:34

FBase is a base class for all facade classes. It provides a way to extend classes with static and instance methods. The _initialize as a special method that will be called after the constructor. You should never call it directly.

Extends

Constructors

new FBlob()

new FBlob(_blob, _injector): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:35

Parameters

ParameterType
_blobNullable<Blob>
_injectorInjector

Returns

FBlob

Overrides

FBase.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseFBase._disposedpackages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96
_injectorreadonlyInjectorundefined-packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:37

Methods

copyBlob()

copyBlob(): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:52

Returns a copy of this blob.

Returns

FBlob

a new blob by copying the current blob

Example

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

dispose()

dispose(): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FBase.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FBase.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FBase.ensureNotDisposed


getAs()

getAs(contentType): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:66

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

Parameters

ParameterTypeDescription
contentTypestringthe content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types

Returns

FBlob

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

Example

const blob = univerAPI.newBlob(blob);
const newBlob = blob.getBlob();

getBytes()

getBytes(): Promise<Uint8Array>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:123

Gets the data stored in this blob.

Returns

Promise<Uint8Array>

the blob content as a byte array

Example

const blob = univerAPI.newBlob(blob);
const newBlob = blob.getBytes();
console.log(newBlob);

getContentType()

getContentType(): undefined | string

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:186

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

Returns

undefined | string

the content type

Example

const blob = univerAPI.newBlob(blob);
const newBlob = blob.getContentType();
console.log(newBlob);

getDataAsString()

Call Signature

getDataAsString(): Promise<string>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:82

Get the blob as a string.

Returns

Promise<string>

Example
const blob = univerAPI.newBlob(blob);
const newBlob = blob.getDataAsString();
console.log(newBlob);

Call Signature

getDataAsString(charset?): Promise<string>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:94

Get the blob as a string.

Parameters
ParameterTypeDescription
charset?stringthe charset
Returns

Promise<string>

the blob content as a string

Example
const blob = univerAPI.newBlob(blob);
const newBlob = blob.getDataAsString('iso-8859-1');
console.log(newBlob);

setBytes()

setBytes(bytes): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:141

Sets the data stored in this blob.

Parameters

ParameterTypeDescription
bytesUint8Arraya byte array

Returns

FBlob

the blob object

Example

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

setContentType()

setContentType(contentType): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:201

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

Parameters

ParameterTypeDescription
contentTypestringthe content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types

Returns

FBlob

the blob object

Example

const blob = univerAPI.newBlob(blob);
const newBlob = blob.setContentType('text/plain');
console.log(newBlob);

setDataFromString()

Call Signature

setDataFromString(data): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:156

Sets the data stored in this blob.

Parameters
ParameterTypeDescription
datastringblob data string
Returns

FBlob

the blob object

Example
const blob = univerAPI.newBlob();
blob.setDataFromString('Hello, World!');

Call Signature

setDataFromString(data, contentType?): FBlob

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-blob.ts:168

Sets the data stored in this blob.

Parameters
ParameterTypeDescription
datastringa string
contentType?stringthe content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
Returns

FBlob

the blob object

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

extend()

static extend(source): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/facade/f-base.ts:26

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FBase.extend