* Move or copy a file or directory to another location * @param {"copyTO"|"moveTo"} action * @param {string} src * @param {string} dest * @returns {Promise } The new location of the file or directory
(action, src, dest)
| 206 | * @returns {Promise<string>} The new location of the file or directory |
| 207 | */ |
| 208 | moveOrCopy(action, src, dest) { |
| 209 | return new Promise((resolve, reject) => { |
| 210 | reject = setMessage(reject); |
| 211 | this.verify(src, dest) |
| 212 | .then((res) => { |
| 213 | const { src, dest } = res; |
| 214 | |
| 215 | src[action]( |
| 216 | dest, |
| 217 | undefined, |
| 218 | (entry) => resolve(decodeURIComponent(entry.nativeURL)), |
| 219 | reject, |
| 220 | ); |
| 221 | }) |
| 222 | .catch(reject); |
| 223 | }); |
| 224 | }, |
| 225 | |
| 226 | /** |
| 227 | * Return the stats of a file or directory |
no test coverage detected