Skip to content

Object Url

URL representing an object.

🎬 Usage

<script>
    import {object_url} from "sveltecore"

    let file = undefined

    const onFileChange = (e) => {
        const target = e.target
        const files = target.files
        file = files && files.length > 0 ? files[0] : undefined
    }

    $: url = object_url(file)
</script>
<input type="file" on:change="{onFileChange}" />

{url ? url : ""}

👩‍💻API

Arguments

Name Description Type Required
object Object to create URL for Blob or MediaSource Yes

Returns

A URL representing the object.

🧪 Playground


Last update: 2022-11-13