4.1.0 • Published 1 month ago

tus-js-client v4.1.0

Weekly downloads
113,855
License
MIT
Repository
github
Last release
1 month ago

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 v4. If you are looking for the previous major release, after which breaking changes have been introduced, please look at the v3.1.3 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)
    },
  })

  // Check if there are any previous uploads to continue.
  upload.findPreviousUploads().then(function (previousUploads) {
    // Found previous uploads so we select the first one.
    if (previousUploads.length) {
      upload.resumeFromPreviousUpload(previousUploads[0])
    }

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

Documentation

Build status

Actions Status

License

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

talent-app-shell@bitsongjs/bstudioxmgis-tus-loader@infinitebrahmanuniverse/nolb-tusvimeo-video-uploader@everything-registry/sub-chunk-2987package-library-common-react-componentsnodewrite-core-adminoom-ui-pagespodchat-browserposhtiban@caisy/sdk@caisy/upload@arcana/storagebunnynet-stream@contember/vimeo-file-uploader@cognigy/rest-api-client@colorlightcloud/color-design@colorlightcloud/color-lib@dartroom/fileroom-sdk@galaxyproject/galaxy-client@vimeo/vimeowcz-file@victoryoalli/fu.js@bbface/near-bos-webcomponent-livepeer@bugslifesolutions/file-collections@bunnynet/stream@byteark/video-upload-sdk@beam-australia/material-tus@beam-australia/mui-tus-avatar@beam-australia/mui-tus-upload@availity/upload-core@bloque/uppy-companioncockpit-reactwolf-ui@uppy/tus@uppy/companion@vectorly-io/clientxmgis-tus-uploaduppy-photo-manageruppy-serveruppyserveruppeh@ssh-uppy/companion@spread-paul/core@trimm/tus-clientvidyoai-uploadervimeo-upload-clientvimeo-video-uploadvimeovimeo-blob-upload@transloadit/jquery-sdk@types/tus-js-clientcms-upload@goldenplanet/vebto-pixie@goodcastle/file-collectionscloudflare-streamcloudflare-stream-promisefilepunk@elwood/fs-sdk@elwood/workflow-sdkjmapcloud-portaljmapcloud-dashboard-jsleadmapleadmap-web-front-endmedia-platform-js-sdkkiloslynxi-common-pluginlmtoolsnear-bos-webcomponent-livepeerreact-fiberrenesisresource-pondrmc-file-managertransloaditsaas-common-utilssp-community@elwood-studio/js@elwood-studio/sdk@euro.message/rmc-template-wizardstrapi-provider-upload-vimeo@fnc/sanity-plugin-vimeo-browserstrapi-provider-upload-cloudflare-2@lumeweb/libportal@lumeweb/s5-js@filerobot/tus@sourcesoft/uppy@reactioncommerce/file-collectionstusvideovimeo@sme-uploader/tus@startup-booster/curator@suchkovcode/strapi-provider-upload-cloudflare-imgtryupload@ututrust/web-components@24gate/feedback-support@wavestreamlabs/wavestream-sdk-ts@webgeodatavore/uppy@koala/ui@koala/yibin-uifembed-uploader
4.1.0

1 month ago

4.0.1

4 months ago

3.1.3

5 months ago

3.1.2

5 months ago

4.0.0

5 months ago

3.1.1

9 months ago

3.1.0

1 year ago

3.0.1

2 years ago

2.3.2

2 years ago

3.0.0

2 years ago

3.0.0-0

2 years ago

2.3.1

2 years ago

2.3.0

3 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.0-1

4 years ago

2.0.0-0

4 years ago

1.8.0

5 years ago

1.8.0-2

5 years ago

1.8.0-1

5 years ago

1.8.0-0

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.6.0-rc1

5 years ago

1.5.2

5 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

9 years ago