Home / Companies / SurrealDB / Blog / Post Details
Content Deep Dive

File support in SurrealDB 3.0

Blog post from SurrealDB

Post Details
Company
Date Published
Author
SurrealDB
Word Count
1,317
Language
English
Hacker News Points
-
Summary

SurrealDB 3.0 introduces experimental native file support, allowing users to store files directly within the database instead of externally. This feature is enabled by defining a "bucket" for file storage, which can be set to a physical location or in-memory, and utilized across all namespaces and databases with a global bucket environment variable. Users can manipulate files using file pointers and associated functions like .put(), .get(), and .rename(). SurrealDB also enhances type conversions for bytes, supporting functions like type::string_lossy() to handle partially corrupted data. Additionally, encoding and decoding bytes into SurrealDB types is possible, facilitating applications such as temporary shopping cart storage. Future developments aim to integrate with large-scale object storage solutions like Amazon S3, further expanding SurrealDB's capabilities for apps relying on lightweight file storage.