@minespider/core-bundles
Version:
A high-level SDK for Minespider Core. It abstract the low-level features from the core SDK for a more high-level usage such as DAPPs. Some of the features are 1:1 with the SDK some others abstract some low-level interactions or multiple actions
24 lines (21 loc) • 602 B
text/typescript
export class Blob {
private content: Buffer;
readonly type: string;
readonly encoding?: string;
readonly size: number;
constructor(
content: Buffer,
options: { type?: string; encoding?: string; size?: number }
) {
this.content = content;
this.type = options.type || "text/plain";
this.encoding = options.encoding;
this.size = options.size || content.byteLength;
}
slice(start?: number, end?: number, contentType?: string) {
return new Blob(this.content.slice(start, end), {
type: contentType || this.type,
encoding: this.encoding
});
}
}