Skip to main content
Version: 7.2.0

Blob

API Reference: Blob

Blob is "binary large object". It can be used for files without an handler or for a large chunk of raw data.

TypeScript
import PageSampleDesign from "generated/pages/page3";
import { Route, Router } from "@smartface/router";
import Application from "@smartface/native/application";
import Blob from "@smartface/native/global/blob";
import Image from "@smartface/native/ui/image";

//You should create new Page from UI-Editor and extend with it.
export default class Sample extends PageSampleDesign {
myImage: Image;
blob: Blob;
constructor(private router?: Router, private route?: Route) {
super({});
}

// The page design has been made from the code for better
// showcase purposes. As a best practice, remove this and
// use WYSIWYG editor to style your pages.
centerizeTheChildrenLayout() {
this.dispatch({
type: "updateUserStyle",
userStyle: {
flexProps: {
flexDirection: 'ROW',
justifyContent: 'CENTER',
alignItems: 'CENTER'
}
}
})
}

onShow() {
super.onShow();
const { headerBar } = this;
Application.statusBar.visible = false;
headerBar.visible = false;

}

onLoad() {
super.onLoad();
this.centerizeTheChildrenLayout();
let blobSize;
let blobType;
this.myImage = Image.createFromFile("images://smartface.png");
this.blob = this.myImage.compress(Image.Format.JPEG, 100, ({blob}) => {
blobSize = blob.size;
blobType = blob.type;
}, ({message}) => {
throw new Error(message);
});
}
}