Class Storage#moveFile
storage
- Defined in: storage.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Storage#moveFile(successCallback, errorCallback, options)
Moves a file or directory.
|
Class Detail
Storage#moveFile(successCallback, errorCallback, options)
Moves a file or directory.
If newPath already exists, it will be replaced.
If newPath and oldPath refer to a same file, it will return success but do nothing.
If oldPath is a directory, newPath must be either non-existing or emptry directory.
file://internal/external, file://usb:[usb_port]/content are predefined directory for special use, and cannot be moved.
function moveFile() {
var successCb = function (){
console.log("Move File done.");
};
var failureCb = function(cbObject){
var errorCode = cbObject.errorCode;
var errorText = cbObject.errorText;
console.log( " Error Code [" + errorCode + "]: " + errorText);
};
var options = {
oldPath: 'file://internal/org.txt',
newPath : 'file://internal/new.txt'
};
var storage = new Storage();
storage.moveFile(successCb, failureCb, options);
}
- Parameters:
- {Function} successCallback
- success callback function.
- {Function} errorCallback
- failure callback function.
- {Object} options
Property Type Description Required oldPath Storage.SCAP_URI URI to the original file (internal/usb/sdcard). required newPath Storage.SCAP_URI URI to the new file (internal/usb/sdcard). required
- Since:
- 1.2
- Returns:
After the method is successfully executed, successCallback is called without any parameter. If an error occurs, errorCallback is called with errorCode and errorText. To see how error codes are defined, check Error.ERROR_CODE