पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv1.0.2

tus_client

डार्ट के लिए एक tus क्लाइंट, जो tus प्रोटोकॉल का उपयोग करके निरंतर अपलोड की अनुमति देता है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
145
लाइक
25
Pub अंक
140

पैकेज इंस्टॉल करें

flutter pub add tus_client

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

tus_client पैकेज तुस प्रोटोकॉल का डार्ट वास्तविकीकरण है, जो विभिन्न मंचों पर आवधिक फ़ाइल अपलोड की अनुमति देता है। यह बड़े फ़ाइलों को खंडों में तोड़कर और बीच में रुके हुए ट्रांसफर को जारी रखकर उपयोगकर्ताओं को विश्वसनीय रूप से फ़ाइल अपलोड करने की अनुमति देता है। क्लाइंट सभी प्रमुख मंचों को समर्थन देता है, जिनमें एंड्रॉइड, आईओएस, वेब, मैकओएस, विंडोज और लिनक्स शामिल हैं। विश्वसनीयता और दक्षता के लिए बनाया गया, यह नेटवर्क अंतराप्रवाह को धैर्यपूर्वक संभालता है और अपलोड के दौरान डेटा अखंडता सुनिश्चित करता है। सुरक्षित, स्केलेबल फ़ाइल ट्रांसफर क्षमता की आवश्यकता वाले एप्लिकेशन के लिए आदर्श।

उपयोग

  • बड़े फ़ाइल अपलोड
  • ऑफलाइन-प्रथम फ़ाइल ट्रांसफर
  • बादल भंडारण एकीकरण
  • अपलोड के दौरान प्रगति ट्रैकिंग
  • अनुपलब्ध अपलोड को पुनरारंभ करें

मुख्य विशेषताएँ

  • पुनरारंभ योग्य अपलोड
  • प्लेटफॉर्म के अनुकूल समर्थन
  • चंक्ड फ़ाइल ट्रांसफर
  • अपलोड प्रगति निगरानी
  • त्रुटि पर स्वचालित पुनर्प्रयास

इनके लिए उपयुक्त

  • फ़ाइल-भारी एप्लिकेशन
  • अपलोड की आवश्यकता वाले मोबाइल और वेब ऐप्स
  • विश्वसनीय डेटा स्थानांतरण की आवश्यकता वाले अनुप्रयोग
  • tus प्रोटोकॉल का उपयोग करने वाले विकासकर्मी
  • tus क्लाइंट्स के साथ एकीकृत बैकएंड सेवाएँ

विचार योग्य बातें

  • tus-संगत सर्वर की आवश्यकता है
  • फ़ाइल अपलोड उपयोग केस के लिए सीमित
  • कस्टम हेडर के लिए अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता हो सकती है
  • स्ट्रीमिंग या रियल-टाइम डेटा के लिए उपयुक्त नहीं
  • अनुकूल प्रदर्शन के लिए स्थिर इंटरनेट कनेक्शन पर निर्भर

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

A tus client

Pub Version Build Status codecov


A tus client in pure dart. Resumable uploads using tus protocol

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 a network issue or server outage.

Usage

import 'package:cross_file/cross_file.dart' show XFile;

// File to be uploaded
final file = XFile("/path/to/my/pic.jpg");

// Create a client
final client = TusClient(
    Uri.parse("https://master.tus.io/files/"),
    file,
    store: TusMemoryStore(),
);

// Starts the upload
await client.upload(
    onComplete: () {
        print("Complete!");

        // Prints the uploaded file URL
        print(client.uploadUrl.toString());
    },
    onProgress: (progress) {
        print("Progress: $progress");
    },
);
Using Persistent URL Store

This is only supported on Flutter Android, iOS, desktop and web. You need to add to your pubspec.yaml:

dependencies:
  tus_client: ^1.0.2
  tus_client_file_store: ^0.0.3
import 'package:path_provider/path_provider.dart';
import 'package:tus_client_file_store/tus_client_file_store.dart' show TusFileStore;
import 'package:path/path.dart' as p;

// Directory the current uploads will be saved in
final tempDir = (await getTemporaryDirectory()).path;
final tempDirectory = Directory(p.join(tempDir, "tus-uploads"));

// Create a client
final client = TusClient(
    Uri.parse("https://example.com/tus"),
    file,
    store: TusFileStore(tempDirectory),
);

// Start upload
await client.upload();
Adding Extra Headers
final client = TusClient(
    Uri.parse("https://master.tus.io/files/"),
    file,
    headers: {"Authorization": "..."},
);
Adding extra data
final client = TusClient(
    Uri.parse("https://master.tus.io/files/"),
    file,
    metadata: {"for-gallery": "..."},
);
Changing chunk size

The file is uploaded in chunks. Default size is 512KB. This should be set considering speed of upload vs device memory constraints

final client = TusClient(
    Uri.parse("https://master.tus.io/files/"),
    file,
    maxChunkSize: 10 * 1024 * 1024,  // chunk is 10MB
);
Pausing upload

Pausing upload can be done after current uploading in chunk is completed.

final client = TusClient(
    Uri.parse("https://master.tus.io/files/"),
    file
);

// Pause after 5 seconds
Future.delayed(Duration(seconds: 5)).then((_) =>client.pause());

// Starts the upload
await client.upload(
    onComplete: () {
        print("Complete!");
    },
    onProgress: (progress) {
        print("Progress: $progress");
    },
);

Example

For an example of usage in a Flutter app (using file picker) see: /example

Maintainers

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 3 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।