tus-js-client

A pure JavaScript client for the tus resumable upload protocol

Github星跟蹤圖

tus-js-client

tus is a protocol based on HTTP for resumable file uploads. Resumable
means that an upload can be interrupted at any moment and can be resumed without
re-uploading the previous data again. An interruption may happen willingly, if
the user wants to pause, or by accident in case of an network issue or server
outage.

tus-js-client is a pure JavaScript client for the tus resumable upload protocol and can be used inside browsers, Node.js,
React Native and Apache Cordova applications.

Protocol version: 1.0.0

This branch contains tus-js-client v2. If you are looking for the previous major release, after which breaking changes have been introduced, please look at the v1.8.0 tag.

Example

input.addEventListener("change", function(e) {
    // Get the selected file from the input element
    var file = e.target.files[0]

    // Create a new tus upload
    var upload = new tus.Upload(file, {
        endpoint: "http://localhost:1080/files/",
        retryDelays: [0, 3000, 5000, 10000, 20000],
        metadata: {
            filename: file.name,
            filetype: file.type
        },
        onError: function(error) {
            console.log("Failed because: " + error)
        },
        onProgress: function(bytesUploaded, bytesTotal) {
            var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2)
            console.log(bytesUploaded, bytesTotal, percentage + "%")
        },
        onSuccess: function() {
            console.log("Download %s from %s", upload.file.name, upload.url)
        }
    })

    // Start the upload
    upload.start()
})

Documentation

Build status

Build Status

License

This project is licensed under the MIT license, see LICENSE.

主要指標

概覽
名稱與所有者tus/tus-js-client
主編程語言JavaScript
編程語言HTML (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2015-04-06 17:11:33
推送於2025-10-15 20:02:22
最后一次提交
發布數51
最新版本名稱5.0.0-pre1 (發布於 )
第一版名稱v1.1.0 (發布於 2015-11-14 16:22:39)
用户参与
星數2.5k
關注者數38
派生數337
提交數778
已啟用問題?
問題數337
打開的問題數47
拉請求數348
打開的拉請求數15
關閉的拉請求數103
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?