4.2.3 • Published 9 months ago

tus-js-client v4.2.3

Weekly downloads
113,855
License
MIT
Repository
github
Last release
9 months 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-2987wolf-uiwondaris-nodejs-sdkwcz-filexmgis-tus-uploadvisio-cms-libvidyoai-uploader@colorlightcloud/color-design@colorlightcloud/color-lib@dartroom/fileroom-sdk@caisy/sdk@caisy/upload@bunnynet/streamjmapcloud-portaljmapcloud-dashboard-jskilos@elwood/fs-sdk@elwood/workflow-sdk@contember/vimeo-file-uploaderstrapi-provider-upload-cloudflare-2strapi-provider-upload-vimeosp-communitytryuploadtusvideovimeotrioslibtransloadit@sourcesoft/uppy@arcana/storage@ample-launchpad/ui@beam-australia/mui-tus-avatar@beam-australia/mui-tus-upload@beam-australia/material-tus@bbface/near-bos-webcomponent-livepeer@bloque/uppy-companion@bugslifesolutions/file-collections@byteark/video-upload-sdk@24gate/feedback-support@cognigy/rest-api-clientvimeovimeo-blob-uploadvimeo-upload-clientvimeo-video-uploaduppy-photo-manageruppy-serveruppyserveruppeh@filelib/client@fathomed/cf-video-uploader@fnc/sanity-plugin-vimeo-browser@hushpoison/vimeo-api@huydd/companion@filerobot/tus@elwood-studio/js@elwood-studio/sdk@galaxyproject/galaxy-client@goldenplanet/vebto-pixie@euro.message/rmc-template-wizard@goodcastle/file-collections@itsaazcom/components@lumeweb/s5-js@lumeweb/libportal@mettle-studio/strapi-provider-upload-cloudflare-2@nextgis/ngw-uploader@epilogo/files-client@metarisc/metarisc-js@maveio/components@koala/ui@koala/yibin-ui@hypermedialabs/uploader@kengoldfarb/uppy-companion@reactioncommerce/file-collections@startup-booster/curator@spread-paul/core@sme-uploader/tus@ssh-uppy/companionms-filespackage-library-common-react-componentsoom-ui-pagesserverizeroboto-jsreact-fibersaas-common-utilsnear-bos-webcomponent-livepeernodewrite-core-adminplasmic-supabase-shamspodchat-browserposhtibanresource-pondrenesisrmc-file-managergnurub-companiongolden-sample-web-v2leadmapleadmap-web-front-endlynxi-common-plugin
4.2.3

9 months ago

4.2.2

9 months ago

4.2.1

9 months ago

4.2.0

9 months ago

4.1.0

1 year ago

4.0.1

1 year ago

3.1.3

2 years ago

3.1.2

2 years ago

4.0.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

3 years ago

2.3.2

3 years ago

3.0.0

3 years ago

3.0.0-0

3 years ago

2.3.1

3 years ago

2.3.0

4 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-1

5 years ago

2.0.0-0

5 years ago

1.8.0

6 years ago

1.8.0-2

6 years ago

1.8.0-1

6 years ago

1.8.0-0

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.6.0-rc1

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.3

8 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.4

9 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago