* Opens a file asynchronously. * @param {string} filePath The path to open * @param {string|Function} [flags] Open flags or callback * @param {number|Function} [mode] File mode or callback * @param {Function} [callback] Callback (err, fd)
(filePath, flags, mode, callback)
| 778 | * @param {Function} [callback] Callback (err, fd) |
| 779 | */ |
| 780 | open(filePath, flags, mode, callback) { |
| 781 | if (typeof flags === 'function') { |
| 782 | callback = flags; |
| 783 | flags = 'r'; |
| 784 | mode = undefined; |
| 785 | } else if (typeof mode === 'function') { |
| 786 | callback = mode; |
| 787 | mode = undefined; |
| 788 | } |
| 789 | |
| 790 | const providerPath = this.#toProviderPath(filePath); |
| 791 | this[kProvider].open(providerPath, flags, mode) |
| 792 | .then((handle) => { |
| 793 | const fd = openVirtualFd(handle); |
| 794 | callback(null, fd); |
| 795 | }, (err) => callback(err)); |
| 796 | } |
| 797 | |
| 798 | /** |
| 799 | * Closes a file descriptor asynchronously. |
nothing calls this directly
no test coverage detected