fs.prepend

fs.prepend

fs.prepend

Function

Write the content to the beginning of the file.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
contentAnyNo''Content to prepend; arrays and objects write JSON strings.

Return value

TypeDescription
IntReturns the total number of bytes of the new file contents.

Example

Notes

  • When the file exists, the old content will be read first and then written back as a whole.