Skip to content

Commit

Permalink
fix: upload CAR example
Browse files Browse the repository at this point in the history
fixes #94
  • Loading branch information
Alan Shaw committed Jun 14, 2024
1 parent 7a96773 commit fa2db64
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/pages/docs/concepts/car.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,12 @@ Here's a simple example of loading a CAR file from a Node.js stream and storing

```js
import fs from 'node:fs'
import { CarReader } from '@ipld/car'
import { Readable } from 'node:stream'

async function storeCarFile(filename) {
const inStream = fs.createReadStream(filename)
const car = await CarReader.fromIterable(inStream)
const stream = () => Readable.toWeb(fs.createReadStream(filename))
const client = makeStorageClient()
const cid = await client.uploadCAR(car)
const cid = await client.uploadCAR({ stream })
console.log('Stored CAR file! CID:', cid)
}
```
Expand Down

0 comments on commit fa2db64

Please sign in to comment.