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
    });
  }
}
