How to use @mux/upchunk - 1 common examples

To help you get started, we’ve selected a few @mux/upchunk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github contentful / extensions / marketplace / mux-video-uploader / src / index.tsx View on Github external
onChange = async (e: React.ChangeEvent) => {
    const file = e.currentTarget.files && e.currentTarget.files[0];
    this.setState({ uploadProgress: 1 });

    if (!file) {
      throw Error("Looks like a file wasn't selected");
    }

    try {
      const endpoint = await this.getUploadUrl();

      const upload = createUpload({
        file,
        endpoint,
        chunkSize: 5120, // Uploads the file in ~5mb chunks
      });

      upload.on('error', this.onUploadError);
      upload.on('progress', this.onUploadProgress);
      upload.on('success', this.onUploadSuccess);
    } catch (error) {
      this.setState({ error: error.message });
    }
  };

@mux/upchunk

Dead simple chunked file uploads using Fetch

MIT
Latest version published 8 months ago

Package Health Score

64 / 100
Full package analysis

Popular @mux/upchunk functions