AltExecCnsContract.prototype.sendFile

Save a file protected by access control.

Internally calls http POST /file on the AltExecCnsAPI.

The difference from updateFile is that an error is returned if the data of the specified objectId already exists.

Parameters

Name Type Description
password string Account password
contractName string Target contract name
functionName string Target function name
objectId string DataObject ID
data string File name stored in the data store
file File File to be saved in the data store
params array Parameters to pass to Contract function
abi JSONObject ABI of the contract to call
callback function callback

Callback

Name Type Description
err error Error
txHash string Transaction hash of executed transaction

Usage

contract.sendFile('__PASSWORD__', 'File', 'create', 'file-object1', 'fileName.png', file, ['file1'], abi, function(err, txHash) {
  if (err) console.error(err);
  else console.log(txHash);
}

results matching ""

    No results matching ""