Answer the question
In order to leave comments, you need to log in
How to read node.js documentation?
If there are experienced backend-js developers here, then tell me about the official node.js documentation.
Example: I want to know about the fs.writeFile() method, what parameters it takes. I go to the official site and find this method.
And why is it not indicated there that the
first parameter is the name of the file to be created,
the second parameter is the data to be written,
and the third is the callback.
But on unofficial sites , these moments are described in more detail.
Why write such documentation?
Answer the question
In order to leave comments, you need to log in
on the official website , I scroll a little lower and see
fs.writeFile(file, data[, options], callback)#
history:
- file
<string> | <Buffer> | <URL> | <integer>
filename or file descriptor- data
<string> | <Buffer> | <TypedArray> | <DataView> | <Object>
- options
<Object> | <string>
- encoding
<string> | <null>
Default: 'utf8'- mode
<integer>
Default: 0o666- flag
<string>
See support of file system flags. Default: 'w'.- signal
<AbortSignal>
allows aborting an in-progress writeFile- callback
<Function>
- err
<Error> | <AggregateError>
When file is a filename, asynchronously writes data to the file, replacing the file if it already exists. data can be a string or a buffer.
When file is a file descriptor, the behavior is similar to calling fs.write() directly (which is recommended). See the notes below on using a file descriptor.
The encoding option is ignored if data is a buffer.
If data is a plain object, it must have an own (not inherited) toString function property.
...
fs.write
). After that, the necessary items of the table of contents will be highlighted in yellow and you can easily find the one you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question