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
Parameter | Type |
---|---|
_blob | Nullable <Blob > |
_injector | Injector |
Returns
Overrides
Properties
Property | Modifier | Type | Default value | Inherited from | Defined in |
---|---|---|---|---|---|
_disposed | protected | boolean | false | FBase ._disposed | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96 |
_injector | readonly | Injector | undefined | - | 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
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
disposeWithMe()
disposeWithMe(disposable): IDisposable
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:99
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
ensureNotDisposed()
protected ensureNotDisposed(): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:103
Returns
void
Inherited from
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
Parameter | Type | Description |
---|---|---|
contentType | string | the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types |
Returns
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
Parameter | Type | Description |
---|---|---|
charset ? | string | the 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
Parameter | Type | Description |
---|---|---|
bytes | Uint8Array | a byte array |
Returns
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
Parameter | Type | Description |
---|---|---|
contentType | string | the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types |
Returns
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
Parameter | Type | Description |
---|---|---|
data | string | blob data string |
Returns
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
Parameter | Type | Description |
---|---|---|
data | string | a string |
contentType ? | string | the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types |
Returns
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
Parameter | Type |
---|---|
source | any |
Returns
void