#readwise
# FileStorage - LiteDB :: A .NET Embedded NoSQL Database

## Metadata
- Author: [[litedb.org]]
- Full Title: FileStorage - LiteDB :: A .NET Embedded NoSQL Database
- URL: http://www.litedb.org/docs/filestorage/
## Highlights
- **To keep its memory profile slim, LiteDB limits the size of a documents to 1MB. For most documents, this is plenty. However, 1MB is too small for a useful file storage. For this reason, LiteDB implements FileStorage, a custom collection to store files and streams.**
- FileStorage uses two special collections:
The first collection stores file references and metadata only (by default it is called _files) ... The second collection stores binary data in 255kB chunks (by default it is called _chunks)
- The FileStorage collection contains simple methods like:
Upload: Send file or stream to database. Can be used with file or Stream. If file already exists, file content is overwritten.
Download: Get your file from database and copy to Stream parameter
Delete: Delete a file reference and all data chunks
Find: Find one or many files in _files collection. Returns LiteFileInfo class, that can be download data after.
SetMetadata: Update stored file metadata. This method doesn’t change the value of the stored file. It updates the value of _files.metadata.
OpenRead: Find file by _id and returns a LiteFileStream to read file content as stream