(filepath: string, contents: string, encodingOrOptions?: any)
| 425 | }, |
| 426 | |
| 427 | appendFile(filepath: string, contents: string, encodingOrOptions?: any): Promise<void> { |
| 428 | var b64; |
| 429 | |
| 430 | var options = { |
| 431 | encoding: 'utf8' |
| 432 | }; |
| 433 | |
| 434 | if (encodingOrOptions) { |
| 435 | if (typeof encodingOrOptions === 'string') { |
| 436 | options.encoding = encodingOrOptions; |
| 437 | } else if (typeof encodingOrOptions === 'object') { |
| 438 | options = encodingOrOptions; |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | if (options.encoding === 'utf8') { |
| 443 | b64 = base64.encode(utf8.encode(contents)); |
| 444 | } else if (options.encoding === 'ascii') { |
| 445 | b64 = base64.encode(contents); |
| 446 | } else if (options.encoding === 'base64') { |
| 447 | b64 = contents; |
| 448 | } else { |
| 449 | throw new Error('Invalid encoding type "' + options.encoding + '"'); |
| 450 | } |
| 451 | |
| 452 | return RNFSManager.appendFile(normalizeFilePath(filepath), b64); |
| 453 | }, |
| 454 | |
| 455 | write(filepath: string, contents: string, position?: number, encodingOrOptions?: any): Promise<void> { |
| 456 | var b64; |
nothing calls this directly
no test coverage detected