ithit.webdav.server
Version:
With IT Hit WebDAV Server Engine for Node.js you can create your own WebDAV server, add WebDAV support to your existing Node.js project or DAV-enable your CMS/DMS/CRM.
61 lines (60 loc) • 5 kB
TypeScript
import { IResumableUploadBase } from "./IResumableUploadBase";
import { IResumableUpload } from "./IResumableUpload";
/**
* Implemented on files and folders to report upload progress.
* #####
* @remarks <br><p>
* This interface should be implemented on files that can provide upload progress information to client
* application. Optionally it can be implemented on folder items.
* </p><p>
* This interface should be implemented on files that can provide upload progress information to client application. Optionally it can be implemented on folder items.
*
* The client application requests upload progress If connection was broken (paused) and client would like to restore upload. Client will submit upload-progress request to get number of bytes successfully saved on server side and will start the upload from the next byte.
*
* To check if folder or file supports upload-progress report and resumable upload feature the client application will submit OPTIONS request to that item. If the item implements IUploadProgress interface Engine will add 'resumable-upload' token to DAV response header. See example below.
* </p><p>
* To get information about file upload progress client will submit REPORT request to that file with upload
* progress type. The Engine will call [getUploadProgress](ITHit.WebDAV.Server.ResumableUpload.IUploadProgress#getuploadprogress) method in this case. You will return an
* [IEnumerable`1](System.Collections.Generic.IEnumerable`1) that contains single item (this file implementing [IResumableUpload](ITHit.WebDAV.Server.ResumableUpload.IResumableUpload) ) from
* [getUploadProgress](ITHit.WebDAV.Server.ResumableUpload.IUploadProgress#getuploadprogress) method implementation. The engine will extract necessary info from the
* returned [IResumableUpload](ITHit.WebDAV.Server.ResumableUpload.IResumableUpload) interface and return it to client. The response will contain XML
* with information about upload progress for the requested file: url of the file, number or bytes uploaded,
* total size of the file and time when last save operation occurred.
* </p><p> The response returned by server Engine to client is a REPORT multistatus response that contains three
* properties for each file:
* </p><p> <list type="bullet"><li><description><b>ithit:bytes-uploaded</b> - integer value. Number of bytes uploaded and saved in
* persistent storage. If upload was broken or paused the client application will usually start upload from the
* next byte returned in this property.</description></li><li><description><b>ithit:last-chunk-saved</b> - date\timein in RFC 1123 format. Indicates when last chunk
* was saved. May be used in admin applications and automatic maintenance tools to remove files that were not
* fully uploaded.</description></li><li><description><b>ithit:total-content-length</b> - integer value. Total file size that is being uploaded
* to server. Thin client applications may use this value for displaying upload progress.</description></li></list></p><p>
* </p><p>
* The client application can also submit upload-progress REPORT request to a folder. In this case from your
* [getUploadProgress](ITHit.WebDAV.Server.ResumableUpload.IUploadProgress#getuploadprogress) property implementation you will return IEnumerable containing files that are being uploaded
* that reside in the folder's subtree. The response XML will contain info about each file from the list in a separate response tag.
* </p><p>
* If item does not support upload-progress report and server is based on IT Hit WebDAV Server Engine the server
* will respond with '403 Forbidden' to
* REPORT request. The body will contain <A:supported-report xmlns="DAV:"/> element. If server does not support
* REPORT verb you will get 405 Method Not Allowed response.
* </p>
*/
export interface IUploadProgress extends IResumableUploadBase {
/**
* Gets IEnumerable with items that are being uploaded to this item subtree.
* @remarks <br><p>
* Returns [IEnumerable`1](System.Collections.Generic.IEnumerable`1) with a single item if implemented on file items. Return all items that are being uploaded to
* this subtree if implemented on folder items.
* </p><p>
* Engine calls [IHierarchyItem.path](ITHit.WebDAV.Server.IHierarchyItem#path) ,
* [IResumableUpload.lastChunkSaved](ITHit.WebDAV.Server.ResumableUpload.IResumableUpload#lastchunksaved) ,
* [IResumableUpload.bytesUploaded](ITHit.WebDAV.Server.ResumableUpload.IResumableUpload#bytesuploaded) ,
* [IResumableUpload.totalContentLength](ITHit.WebDAV.Server.ResumableUpload.IResumableUpload#totalcontentlength) and returns this information to
* client.
* </p>
*
* @throws [DavException]{@link DavException} In other cases.
* @returns Information about upload progress.
*/
getUploadProgress(): IResumableUpload[];
}