generated from fission-codes/project-template
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use newer js-ipfs proxy libraries (#288)
* Stop pinning * Upgrade js-ipfs proxy libraries * It's alive! * v2 ipfs worker * Update changelog * Fix most of the tests * Use dag.import * Bump version to 0.29 Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
- Loading branch information
Showing
11 changed files
with
795 additions
and
1,778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const VERSION = "0.28.2" | ||
export const VERSION = "0.29.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,5 @@ export const setup = { | |
user: "fission.name" | ||
}, | ||
|
||
shouldPin: true, | ||
shouldPin: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,17 @@ | ||
import * as fs from "fs" | ||
import all from "it-all" | ||
import { IPFS } from "ipfs-core" | ||
import { CID } from "multiformats" | ||
import { CarBlockIterator } from "@ipld/car" | ||
|
||
/** | ||
* @returns the roots defined in the CAR file | ||
*/ | ||
export async function loadCAR(filepath: string, ipfs: IPFS): Promise<{ roots: CID[]; cids: CID[] }> { | ||
export async function loadCAR(filepath: string, ipfs: IPFS): Promise<{ roots: CID[] }> { | ||
const inStream = fs.createReadStream(filepath) | ||
try { | ||
const cids: CID[] = [] | ||
const blockIterator = await CarBlockIterator.fromIterable(inStream) | ||
for await (const block of blockIterator) { | ||
cids.push(block.cid) | ||
await ipfs.block.put(block.bytes, { cid: block.cid }) | ||
} | ||
return { | ||
roots: await blockIterator.getRoots(), | ||
cids, | ||
} | ||
const roots = await all(ipfs.dag.import(inStream)) | ||
return { roots: roots.map(root => root.root.cid) } | ||
} finally { | ||
inStream.close() | ||
} | ||
} | ||
|
Oops, something went wrong.