* Implements the writable _write method. * @param {Buffer|string} chunk Data to write * @param {string} encoding Encoding * @param {Function} callback Callback
(chunk, encoding, callback)
| 295 | * @param {Function} callback Callback |
| 296 | */ |
| 297 | _write(chunk, encoding, callback) { |
| 298 | if (this.destroyed || this.#fd === null) { |
| 299 | callback(createEBADF('write')); |
| 300 | return; |
| 301 | } |
| 302 | |
| 303 | try { |
| 304 | const buffer = typeof chunk === 'string' ? |
| 305 | Buffer.from(chunk, encoding) : chunk; |
| 306 | this.#vfs.writeSync(this.#fd, buffer, 0, buffer.length, null); |
| 307 | this.bytesWritten += buffer.length; |
| 308 | this.pending = false; |
| 309 | callback(); |
| 310 | } catch (err) { |
| 311 | callback(err); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Implements the writable _final method (flush before close). |
nothing calls this directly
no test coverage detected