How to use the tus-js-client.canStoreURLs function in tus-js-client

To help you get started, we’ve selected a few tus-js-client 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 DefinitelyTyped / DefinitelyTyped / types / tus-js-client / tus-js-client-tests.ts View on Github external
import * as Tus from 'tus-js-client';

const isSupported = Tus.isSupported;
const canStoreURLs = Tus.canStoreURLs;
const defaultChunkSize = Tus.defaultOptions.chunkSize;

const file = new File(["foo"], "foo.txt", {
  type: "text/plain",
});

const upload = new Tus.Upload(file, {
    endpoint: "",
    fingerprint: (file: File) => file.name,
    resume: true,
    metadata: {
        filename: "foo.txt"
    },
    onProgress: (bytesSent: number, bytesTotal: number) => {
        const percentage = (bytesSent / bytesTotal * 100).toFixed(2);
        console.log(bytesSent, bytesTotal, percentage + "%");

tus-js-client

A pure JavaScript client for the tus resumable upload protocol

MIT
Latest version published 2 months ago

Package Health Score

89 / 100
Full package analysis