AltExecCnsContract.prototype.getFile

Gets a file protected by access control.

Internally calls http GET /file on the AltExecCnsAPI.

Parameters

Name Type Description
password string Account password
contractName string Target contract name
functionName string Target function name
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
file File Files retrieved from the data store

Usage

contract.getFile('__PASSWORD__', 'File', 'getObjectId', ['file1'], abi, function(err, file) {
  if (err) console.error(err);
  else {
      var link = document.createElement("a");
      document.body.appendChild(link);
      link.href = window.URL.createObjectURL(file);
      link.download = file.name;
      link.click();
      window.URL.revokeObjectUrl(link.href);
      document.body.removeChild(link);
  }
}

results matching ""

    No results matching ""