Skip to content

Commit 3964220

Browse files
committed
browserpod: document read method on files
1 parent 3bb2f7a commit 3964220

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: read
3+
description: Read data from the file
4+
---
5+
6+
```ts
7+
class BinaryFile {
8+
async read(length: int): Promise<ArrayBuffer>;
9+
}
10+
```
11+
12+
## Parameters
13+
14+
- **length** (`int`) - Lenght in bytes of the data to be read.
15+
16+
## Returns
17+
18+
`read` returns a [Promise] which is resolved when the operation has succeded. The promise resolves to an `ArrayBuffer` containing the data that was read. On success the seek position is updated. If there is an error during the read, the [Promise] will be rejected.
19+
20+
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: read
3+
description: Read data from the file
4+
---
5+
6+
```ts
7+
class TextFile {
8+
async read(length: int): Promise<string>;
9+
}
10+
```
11+
12+
## Parameters
13+
14+
- **length** (`int`) - Lenght in bytes of the data to be read and decoded as utf-8 into a string.
15+
16+
## Returns
17+
18+
`read` returns a [Promise] which is resolved when the operation has succeded. The promise resolves to a string representing the data decoded as utf-8. On success the seek position is updated. If there is an error during the read, the [Promise] will be rejected.
19+
20+
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
File renamed without changes.

0 commit comments

Comments
 (0)