#mizchi/js_web/blob

    Blob API for binary data handling.

    #Installation

    Add to your moon.pkg.json:

    { "import": [ "mizchi/js", "mizchi/js_web/blob" ] }

    #Overview

    Provides bindings for the Blob and File APIs, representing immutable binary data.

    #Usage Example

    fn main {
    // Create a Blob from string
    let blob = @blob.Blob::from_string("Hello, world!")

    // Get blob size
    let size = blob.size()

    // Get blob type
    let mime_type = blob.type_()

    // Slice a blob
    let slice = blob.slice(0, 5)

    // Create from array of parts
    let parts = ["part1", "part2"]
    let combined = @blob.Blob::from_array(parts)
    }

    #Available Types

    • Blob - Immutable binary data
    • File - Blob with name and metadata

    #Reference

    Blob

    pub(all) struct Blob {
    size : Int
    }

    Web Blob API https://developer.mozilla.org/ja/docs/Web/API/Blob

    Blob::arrayBuffer

    #alias(array_buffer)
    async fn Blob::arrayBuffer(self : Blob) ->
    ArrayBuffer

    Get the Blob contents as ArrayBuffer

    Blob::as_any

    fn Blob::as_any(self : Blob) ->
    Any

    Blob::contentType

    #alias(content_type)
    fn Blob::contentType(self : Blob) -> String

    Get the content type of the Blob

    Blob::new

    fn Blob::new(data : Array[
    Any
    ], content_type? : String) -> Blob

    Create a new Blob

    Blob::slice

    fn Blob::slice(self : Blob, start? : Int, end? : Int, content_type? : String) -> Blob

    Create a new Blob containing a slice of this Blob

    Blob::stream

    Get a ReadableStream for the Blob contents

    Blob::text

    async fn Blob::text(self : Blob) -> String

    Get the Blob contents as text

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io