From e2ae5ef9e1ff8f45d917785d0d9d9c6f2975119f Mon Sep 17 00:00:00 2001 From: emi~ Date: Tue, 13 Feb 2024 01:57:36 -0300 Subject: [PATCH 1/2] javascript-api: Fix a case of trailing whitespace --- _i18n/en/_docs/javascript-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_i18n/en/_docs/javascript-api.md b/_i18n/en/_docs/javascript-api.md index d406a6e..0ac5a97 100644 --- a/_i18n/en/_docs/javascript-api.md +++ b/_i18n/en/_docs/javascript-api.md @@ -293,7 +293,7 @@ Clone **[this repo](https://github.com/oleavr/frida-agent-example)** to get star rely on debugger-friendly binaries or presence of debug information to do a good job, whereas the fuzzy backtracers perform forensics on the stack in order to guess the return addresses, which means you will get false - positives, but it will work on any binary. The generated backtrace is + positives, but it will work on any binary. The generated backtrace is currently limited to 16 frames and is not adjustable without recompiling Frida. From 02e3d37fbfac58ca4122deaa3e067cffc1013878 Mon Sep 17 00:00:00 2001 From: emi~ Date: Tue, 13 Feb 2024 01:45:07 -0300 Subject: [PATCH 2/2] javascript-api: Add missing docs for new File APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ole André Vadla Ravnås --- _i18n/en/_docs/javascript-api.md | 37 +++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/_i18n/en/_docs/javascript-api.md b/_i18n/en/_docs/javascript-api.md index 0ac5a97..a8b4bab 100644 --- a/_i18n/en/_docs/javascript-api.md +++ b/_i18n/en/_docs/javascript-api.md @@ -1439,15 +1439,50 @@ All methods are fully asynchronous and return Promise objects.

### File ++ `File.readAllBytes(path)`: synchronously read all bytes from the file + specified by `path` and return them as an `ArrayBuffer`. + ++ `File.readAllText(path)`: synchronously read all text from the file + specified by `path` and return it as a string. The file must be UTF-8 + encoded, and an exception will be thrown if this is not the case. + ++ `File.writeAllBytes(path, data)`: synchronously write `data` to the file + specified by `path`, where `data` is an `ArrayBuffer`. + ++ `File.writeAllText(path, text)`: synchronously write `text` to the file + specified by `path`, where `text` is a string. The file will be UTF-8 + encoded. + + `new File(filePath, mode)`: open or create the file at `filePath` with the `mode` string specifying how it should be opened. For example `"wb"` to open the file for writing in binary mode (this is the same format as `fopen()` from the C standard library). +- `tell()`: return the current position of the file pointer within the file. + +- `seek(offset[, whence])`: move the file pointer to a new location. `offset` + is the position to move to, and `whence` is the starting point for the + offset (`File.SEEK_SET` for the beginning of the file, `File.SEEK_CUR` for + the current file position, or `File.SEEK_END` for the end of the file). + +- `readBytes([size])`: read and return `size` bytes from the file starting + from the current file pointer position as an `ArrayBuffer`. If `size` is not + specified, reads until the end of the file from the current position. + +- `readText([size])`: read and return `size` characters from the file starting + from the current file pointer position as a string. If `size` is not + specified, reads text until the end of the file from the current position. + The bytes being read must be UTF-8 encoded, and an exception will be thrown + if this is not the case. + +- `readLine()`: read and return the next line as a string. Starts reading from + the current file pointer position. The returned line does not include the + newline character. + - `write(data)`: synchronously write `data` to the file, where `data` is either a string or a buffer as returned by [`NativePointer#readByteArray`](#nativepointer-readbytearray) -- `flush()`: flush any buffered data to the underlying file +- `flush()`: flush any buffered data to the underlying file. - `close()`: close the file. You should call this function when you're done with the file unless you are fine with this happening when the object is