Skip to content

Commit

Permalink
Documentation formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkerTomatoes committed Dec 1, 2024
1 parent b3504de commit f6a54ae
Show file tree
Hide file tree
Showing 17 changed files with 227 additions and 193 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,20 @@ const { FatFsDisk } = require('fatfs-wasm')
```

## Using
FatFs can be used with typed arrays to partition and format disk images:
FatFs can be used with typed arrays to create disk images:
```typescript
const data = new Uint8Array(1 << 23);
const disk = FatFsDisk.create(data);
disk.fdisk(0, [100]); // Partition 100% to volume 0
disk.mkfs('', 0); // Format default drive
disk.mount(''); // Mount workspace
disk.mkfs(); // Format filesystem
disk.mount(); // Mount workspace
```

Or open existing ones:
```typescript
const response = await fetch('disk.img');
const data = new Uint8Array(response.arrayBuffer());
const disk = FatFsDisk.create(data);
disk.mount(''); // Mount workspace
disk.mount(); // Mount workspace
```

Once a workspace is mounted, the library provides APIs for manipulating files:
Expand All @@ -56,6 +55,9 @@ const file = disk.open('file.txt', FatFsMode.READ);
const buffer = new Uint8Array(1024);
file.read(buffer);
file.close();

// Or, for convenience:
const file = disk.readFile('file.txt');
```

As well as iterating directories
Expand All @@ -81,10 +83,10 @@ To build, open a terminal in MacOS, Linux, or WSL with clang installed and run t
cd native
./build.sh
```
This will build `ff.wasm` and copy it to the `src` directory.
This will build `ff_single.wasm` and `ff_multi.wasm` (multi-partition support) and copy it to the `src` directory.


## Running Tests
```
npx jest
npx vitest
```
16 changes: 9 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,20 @@ const { FatFsDisk } = require('fatfs-wasm')
```

## Using
FatFs can be used with typed arrays to partition and format disk images:
FatFs can be used with typed arrays to create disk images:
```typescript
const data = new Uint8Array(1 << 23);
const disk = FatFsDisk.create(data);
disk.fdisk(0, [100]); // Partition 100% to volume 0
disk.mkfs('', 0); // Format default drive
disk.mount(''); // Mount workspace
disk.mkfs(); // Format filesystem
disk.mount(); // Mount workspace
```

Or open existing ones:
```typescript
const response = await fetch('disk.img');
const data = new Uint8Array(response.arrayBuffer());
const disk = FatFsDisk.create(data);
disk.mount(''); // Mount workspace
disk.mount(); // Mount workspace
```

Once a workspace is mounted, the library provides APIs for manipulating files:
Expand All @@ -58,6 +57,9 @@ const file = disk.open('file.txt', FatFsMode.READ);
const buffer = new Uint8Array(1024);
file.read(buffer);
file.close();

// Or, for convenience:
const file = disk.readFile('file.txt');
```

As well as iterating directories
Expand All @@ -83,9 +85,9 @@ To build, open a terminal in MacOS, Linux, or WSL with clang installed and run t
cd native
./build.sh
```
This will build `ff.wasm` and copy it to the `src` directory.
This will build `ff_single.wasm` and `ff_multi.wasm` (multi-partition support) and copy it to the `src` directory.

## Running Tests
```
npx jest
npx vitest
```
20 changes: 10 additions & 10 deletions docs/classes/FatFsDir.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ FatFs Directory Reference

#### Defined in

[src/fatfs.ts:665](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L665)
[src/fatfs.ts:679](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L679)

## Properties

Expand All @@ -54,7 +54,7 @@ FatFs Directory Reference

#### Defined in

[src/fatfs.ts:663](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L663)
[src/fatfs.ts:677](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L677)

___

Expand All @@ -64,7 +64,7 @@ ___

#### Defined in

[src/fatfs.ts:661](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L661)
[src/fatfs.ts:675](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L675)

___

Expand All @@ -74,7 +74,7 @@ ___

#### Defined in

[src/fatfs.ts:662](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L662)
[src/fatfs.ts:676](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L676)

## Accessors

Expand All @@ -88,7 +88,7 @@ ___

#### Defined in

[src/fatfs.ts:671](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L671)
[src/fatfs.ts:685](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L685)

## Methods

Expand All @@ -102,7 +102,7 @@ ___

#### Defined in

[src/fatfs.ts:727](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L727)
[src/fatfs.ts:741](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L741)

___

Expand All @@ -118,7 +118,7 @@ Closes the open directory.

#### Defined in

[src/fatfs.ts:678](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L678)
[src/fatfs.ts:692](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L692)

___

Expand All @@ -134,7 +134,7 @@ The f_findnext function searches for a next matched object

#### Defined in

[src/fatfs.ts:715](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L715)
[src/fatfs.ts:729](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L729)

___

Expand All @@ -152,7 +152,7 @@ Information about the next directory entry

#### Defined in

[src/fatfs.ts:690](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L690)
[src/fatfs.ts:704](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L704)

___

Expand All @@ -168,4 +168,4 @@ Rewinds the directory

#### Defined in

[src/fatfs.ts:705](https://github.com/parkertomatoes/fatfs-wasm/blob/fa8ebf7/src/fatfs.ts#L705)
[src/fatfs.ts:719](https://github.com/parkertomatoes/fatfs-wasm/blob/b3504de/src/fatfs.ts#L719)
Loading

0 comments on commit f6a54ae

Please sign in to comment.