Click or drag to resize

ChunkedUploadSource Class

This is preliminary documentation and is subject to change.

A WikiUploadSource that enables chunked stashing and performs final upload by filekey. (MW 1.19+)
Inheritance Hierarchy
SystemObject
  WikiClientLibrary.FilesWikiUploadSource
    WikiClientLibrary.FilesChunkedUploadSource

Namespace: WikiClientLibrary.Files
Assembly: WikiClientLibrary (in WikiClientLibrary.dll) Version: 0.9.0-int.2+447d1d590e6726b7881f750a0a0e42908f3e417e
Syntax
public class ChunkedUploadSource : WikiUploadSource

The ChunkedUploadSource type exposes the following members.

Constructors
 NameDescription
Public methodChunkedUploadSource(WikiSite, Stream) Initialize an instance from a Stream.
Public methodChunkedUploadSource(WikiSite, Stream, String) Initialize an instance from a Stream.
Top
Properties
 NameDescription
Public propertyDefaultChunkSize The chunk size to be used when calling the StashNextChunkAsync overloads without explicitly specifying chunk size.
Public propertyFileKey When IsStashed is true, gets the filekey used for file upload.
Public propertyFileName The file name used in the stashing requests.
Public propertyIsStashed Determines whether the file has been stashed completely.
Public propertyIsStashing Determines whether a chunk is currently uploading for stashing.
Public propertySite 
Public propertySourceStream The source stream containing the content to be uploaded.
Public propertyTotalSize Gets the total size of the file to be uploaded.
Public propertyUploadedSize Gets the size of the uploaded part of file.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetUploadParameters Gets the additional fields that will override the default action=upload parameters.
(Overrides WikiUploadSourceGetUploadParameters(SiteInfo))
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodStashNextChunkAsync 
Public methodStashNextChunkAsync(CancellationToken) 
Public methodStashNextChunkAsync(Int32) 
Public methodStashNextChunkAsync(Int32, CancellationToken) Stash the next chunk in the stream.
Public methodToStringReturns a string that represents the current object.
(Overrides ObjectToString)
Top
Remarks

Since uploading a huge file in a single HTTP POST can be unreliable, MW upload API also supports a chunked upload mode, where you make multiple requests with portions of the file. This is available in MediaWiki 1.20 and above, although prior to version 1.25, SVGs could not be uploaded via chunked uploading.

See https://www.mediawiki.org/wiki/API:Upload#Chunked_uploading .

Before you can use this class with UploadAsync(WikiSite, String, WikiUploadSource, String, Boolean, AutoWatchBehavior, CancellationToken), you need to stash the whole stream in chunks to the server with StashNextChunkAsync or its overloads.

See Also