Skip to content

Commit 271c8e1

Browse files
committed
docs: add trimmed demo
1 parent 8c932bd commit 271c8e1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ npm i @quansync/fs
1414

1515
```ts
1616
import { readFile } from '@quansync/fs'
17+
import { quansync } from 'quansync'
1718

1819
const resultAsync = await readFile('/path', 'utf8')
1920
const resultSync = readFile.sync('/path', 'utf8')
21+
22+
const readFileTrimmed = quansync(function* (id: string) {
23+
const text = yield* readFile(id, 'utf8').trim()
24+
return text
25+
})
26+
const readFileTrimmedSync = readFileTrimmed.sync
2027
```
2128

2229
## Sponsors

0 commit comments

Comments
 (0)