@mindconnect/mindconnect-nodejs
Version:
MindConnect Library for NodeJS (community based)
124 lines (123 loc) • 3.58 kB
TypeScript
/// <reference types="node" />
import { MindConnectAgent } from "../../..";
import { MindConnectBase } from "../../mindconnect-base";
import { SdkClient } from "./sdk-client";
export declare type fileUploadOptionalParameters = {
/**
* Multipart/upload part.
*
* @type {(number | undefined)}
*/
part?: number | undefined;
/**
* File timestamp in mindsphere.
*
* @type {(Date | undefined)}
*/
timestamp?: Date | undefined;
/**
* Description in mindsphere.
*
* @type {(string | undefined)}
*/
description?: string | undefined;
/**
* Mime type in mindsphere.
*
* @type {(string | undefined)}
*/
type?: string | undefined;
/**
* chunkSize. It must be bigger than 5 MB. Default 8 MB.
*
* @type {(number | undefined)}
*/
chunkSize?: number | undefined;
/**
* Number of retries.
*
* @type {(number | undefined)}
*/
retry?: number | undefined;
/**
* log function is called every time a retry happens
*
* @type {(Function | undefined)}
*/
logFunction?: Function | undefined;
/**
* verboseLog for CLI
*
* @type {(Function | undefined)}
*/
verboseFunction?: Function | undefined;
/**
* enables multipart/upload
*
* @type {(boolean | undefined)}
*/
chunk?: boolean | undefined;
/**
* max paralell uploads for parts (default: 3)
*
* @type {(number | undefined)}
*/
parallelUploads?: number | undefined;
/**
* The etag for the upload. if not set the agent will try to guess it.
*
* @type {(number | undefined)}
*/
ifMatch?: number | undefined;
};
/**
* The multipart uploader handles the upload of the files to the mindsphere
* This class is shared between the MindConnectAgent and the IotFileClient
*
* @export
* @class MultipartUploader
* @extends {MindConnectBase}
*/
export declare class MultipartUploader extends MindConnectBase {
private agent?;
private sdkClient?;
private getTotalChunks;
private getTimeStamp;
private getFileType;
private highWatermark;
private getStreamFromFile;
private addDataToBuffer;
private getBareUrl;
private fix_iotFileUpload_3_2_0;
private setIfMatch;
private addUrl;
private MultipartOperation;
private UploadChunk;
/**
* Abort the multipart operation.
*
* @param {string} entityId
* @param {string} filePath
*
* @memberOf MultipartUploader
*/
AbortUpload(entityId: string, filePath: string): Promise<void>;
/**
* Upload file to MindSphere IOTFileService
*
* @param {string} entityId - asset id or agent.ClientId() for agent
* @param {string} filepath - mindsphere file path
* @param {(string | Buffer)} file - local path or Buffer
* @param {fileUploadOptionalParameters} [optional] - optional parameters: enable chunking, define retries etc.
* @returns {Promise<string>} - md5 hash of the file
*
* @memberOf MultipartUploader
*
*/
UploadFile(entityId: string, filepath: string, file: string | Buffer, optional?: fileUploadOptionalParameters): Promise<string>;
private _UploadFile;
private GetToken;
private GetGateway;
private GetConfiguration;
constructor(agent?: MindConnectAgent | undefined, sdkClient?: SdkClient | undefined);
}