Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect IDB interface #126

Open
chuanqisun opened this issue Jun 15, 2024 · 2 comments
Open

Incorrect IDB interface #126

chuanqisun opened this issue Jun 15, 2024 · 2 comments

Comments

@chuanqisun
Copy link

chuanqisun commented Jun 15, 2024

I noticed that current IDB interface had two errors:

  1. The constructor type was typed as a regular function
  2. The readFile was mis-typed as loadFile

/lightning-fs/index.d.ts

export interface IDB {
- constructor(dbname: string, storename: string): IDB
+ new (dbname: string, storename: string): IDB
  saveSuperblock(sb: Uint8Array): TypeOrPromise<void>
  loadSuperblock(): TypeOrPromise<FS.SuperBlock>
- loadFile(inode: number): TypeOrPromise<Uint8Array>
+ readFile(inode: number): TypeOrPromise<Uint8Array>
  writeFile(inode: number, data: Uint8Array): TypeOrPromise<void>
  wipe(): TypeOrPromise<void>
  close(): TypeOrPromise<void>
}
@jcubic
Copy link
Contributor

jcubic commented Jun 15, 2024

Do you want to add a PR?

@chuanqisun
Copy link
Author

chuanqisun commented Jun 15, 2024

See #127. Note that I removed the constructor instead of using new. I realized that my originally proposed fix was wrong as well and the constructor interface was unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants