| 696 | }); |
| 697 | } |
| 698 | appendFile(path, data, options, callback_) { |
| 699 | if (this.server) |
| 700 | throw new Error('Client-only method called in server mode'); |
| 701 | |
| 702 | let callback; |
| 703 | if (typeof callback_ === 'function') { |
| 704 | callback = callback_; |
| 705 | } else if (typeof options === 'function') { |
| 706 | callback = options; |
| 707 | options = undefined; |
| 708 | } |
| 709 | |
| 710 | if (typeof options === 'string') |
| 711 | options = { encoding: options, mode: 0o666, flag: 'a' }; |
| 712 | else if (!options) |
| 713 | options = { encoding: 'utf8', mode: 0o666, flag: 'a' }; |
| 714 | else if (typeof options !== 'object') |
| 715 | throw new TypeError('Bad arguments'); |
| 716 | |
| 717 | if (!options.flag) |
| 718 | options = Object.assign({ flag: 'a' }, options); |
| 719 | this.writeFile(path, data, options, callback); |
| 720 | } |
| 721 | exists(path, cb) { |
| 722 | if (this.server) |
| 723 | throw new Error('Client-only method called in server mode'); |