MCPcopy Index your code
hub / github.com/nodejs/node / appendFile

Method appendFile

lib/internal/vfs/provider.js:320–331  ·  view source on GitHub ↗

* Appends to a file. * @param {string} path The file path * @param {Buffer|string} data The data to append * @param {object} [options] Options * @returns {Promise }

(path, data, options)

Source from the content-addressed store, hash-verified

318 * @returns {Promise<void>}
319 */
320 async appendFile(path, data, options) {
321 if (this.readonly) {
322 throw createEROFS('open', path);
323 }
324 const flag = options?.flag ?? 'a';
325 const handle = await this.open(path, flag, options?.mode);
326 try {
327 await handle.writeFile(data, options);
328 } finally {
329 await handle.close();
330 }
331 }
332
333 /**
334 * Appends to a file synchronously.

Callers 1

appendFileFunction · 0.45

Calls 4

openMethod · 0.95
createEROFSFunction · 0.85
closeMethod · 0.65
writeFileMethod · 0.45

Tested by

no test coverage detected