Skip to content

fix(ext/node): represent sqlite blob as Uint8Array #27889

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

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

littledivy
Copy link
Member

No description provided.

@littledivy littledivy merged commit 057f257 into denoland:main Jan 31, 2025
18 checks passed
@jimmywarting
Copy link
Contributor

Uhm, why represent blob as Uint8Array instead of an actual Blob?

You could store some large binary in sqlite, and when you retrieve it it would just be a Blob whose data is backed up by the filesystem (database) with a pointer to the location where the data is stored (with a potential size & offset)

You could do so much more with a Blob

  • it can be piped instead of being held in memory blob.stream()
  • if you actually want ArrayBuffer or Uint8Array then you can do blob.bytes() || blob.arrayBuffer()

image

https://chromium.googlesource.com/chromium/src/+/HEAD/storage/browser/blob/README.md

@littledivy
Copy link
Member Author

This change is for node:sqlite so it does what Node.js does - https://nodejs.org/api/sqlite.html#type-conversion-between-javascript-and-sqlite

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

Successfully merging this pull request may close these issues.

3 participants