Skip to content

Commit

Permalink
refactor!: Reduce complexity of paths
Browse files Browse the repository at this point in the history
  • Loading branch information
icidasset committed Apr 5, 2024
1 parent e05dd8e commit 2414180
Show file tree
Hide file tree
Showing 19 changed files with 706 additions and 1,545 deletions.
14 changes: 6 additions & 8 deletions packages/nest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ pnpm install @wnfs-wg/nest

## Usage

Scenario 1:<br />
🚀 Create a new file system, create a new file and read it back.

```ts
import { FileSystem, Path } from '@wnfs-wg/nest'

// Provide some block store of the `Blockstore` type from the `interface-blockstore` package
import { IDBBlockstore } from 'blockstore-idb'
```

Scenario 1:<br />
🚀 Create a new file system, create a new file and read it back.

```ts
const blockstore = new IDBBlockstore('path/to/store')
await blockstore.open()

Expand All @@ -49,9 +47,9 @@ const { capsuleKey } = await fs.createPrivateNode({
})

// Write & Read
await fs.write(Path.file('private', 'file'), 'utf8', '🪺')
await fs.write(['private', 'file'], 'utf8', '🪺')

const contents = await fs.read(Path.file('private', 'file'), 'utf8')
const contents = await fs.read(['private', 'file'], 'utf8')
```

Scenario 2:<br />
Expand All @@ -68,7 +66,7 @@ of our root tree, the pointer to our file system.
let fsPointer: CID = await fs.calculateDataRoot()

// When we make a modification to the file system a verification is performed.
await fs.write(Path.file('private', 'file'), 'utf8', '🪺')
await fs.write(['private', 'file'], 'utf8', '🪺')

// If the commit is approved, the changes are reflected in the file system and
// the `commit` and `publish` events are emitted.
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"src"
],
"scripts": {
"lint": "tsc --build && eslint . --quiet --ignore-pattern='README.md' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore",
"lint": "tsc --build && eslint . --quiet && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore",
"build": "tsc --build",
"test": "pnpm run test:node && pnpm run test:browser",
"test:node": "mocha 'test/**/!(*.browser).test.ts' --bail --timeout 30000",
Expand Down
Loading

0 comments on commit 2414180

Please sign in to comment.