Skip to content

Commit

Permalink
Type check CID in public api
Browse files Browse the repository at this point in the history
  • Loading branch information
appcypher committed Mar 30, 2022
1 parent d69fce9 commit 968288f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/fs/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export class FileSystem {
* Loads an existing file system from a CID.
*/
static async fromCID(cid: CID, opts: FileSystemOptions = {}): Promise<FileSystem | null> {
if (!(cid instanceof CID)) throw new Error("Expected a CID object")

const { permissions, localOnly } = opts
const root = await RootTree.fromCID({ cid, permissions })

Expand Down

0 comments on commit 968288f

Please sign in to comment.