Methods
readFile(file, readEncoding) → {Promise.<string>}
- Description:
Asynchronously read the contents of a file.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
string | The path of the file to read. |
readEncoding |
string | The encoding to use for reading (optional). |
Returns:
- A promise resolving to the decoded file content.
- Type
- Promise.<string>
readTextFromFile(file, readEncoding) → {Promise.<string>}
- Description:
Asynchronously read the text contents of a file.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
string | The path of the file to read. |
readEncoding |
string | The encoding to use for reading (optional). |
Returns:
- A promise resolving to the text content of the file.
- Type
- Promise.<string>
write(file, encoding, bom) → {Promise}
- Description:
Asynchronously write the parsed text to a file.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
string | The path of the file to write. |
encoding |
string | The encoding to use for writing (optional). |
bom |
boolean | Whether to include a byte order mark (optional). |
Returns:
- A promise indicating the success of the write operation.
- Type
- Promise
(static) detectEncoding(buffer) → {string}
- Description:
Detect the encoding of the given buffer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
buffer |
Buffer | The buffer to detect encoding from. |
Returns:
- The detected encoding.
- Type
- string