Skip to content

Commit

Permalink
docs: add trimmed demo
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 5, 2025
1 parent 8c932bd commit 271c8e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ npm i @quansync/fs

```ts
import { readFile } from '@quansync/fs'
import { quansync } from 'quansync'

const resultAsync = await readFile('/path', 'utf8')
const resultSync = readFile.sync('/path', 'utf8')

const readFileTrimmed = quansync(function* (id: string) {
const text = yield* readFile(id, 'utf8').trim()
return text
})
const readFileTrimmedSync = readFileTrimmed.sync
```

## Sponsors
Expand Down

0 comments on commit 271c8e1

Please sign in to comment.