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

Improve documentation for copyBundledRealmFiles #4493

Merged
merged 2 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ x.x.x Release notes (yyyy-MM-dd)
* File format: generates Realms with format v22 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).

### Internal
* <Either mention core version or upgrade>
* <Using Realm Core vX.Y.Z>
* <Upgraded Realm Core from vX.Y.Z to vA.B.C>
* Improved documentation for `Realm.copyBundledRealmFiles`

10.16.0 Release notes (2022-4-12)
=============================================================
Expand Down
22 changes: 21 additions & 1 deletion docs/realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,28 @@ class Realm {
static exists(config) {}

/**
* Copy all bundled Realm files to app's default file folder.
* Copy any Realm files (i.e. `*.realm`) bundled with the application from the application
* directory into the application's documents directory, so that they can be opened and used
* by Realm. If the file already exists in the documents directory, it will not be
* overwritten, so this can safely be called multiple times.
*
* This should be called before opening the Realm, in order to move the bundled Realm
* files into a place where they can be written to, for example:
*
* ```
* // Given a bundled file, example.realm, this will copy example.realm (and any other .realm files)
* // from the app bundle into the app's documents directory. If the file already exists, it will
* // not be overwritten, so it is safe to call this every time the app starts.
* Realm.copyBundledRealmFiles();
*
* const realm = await Realm.open({
* // This will open example.realm from the documents directory, with the bundled data in.
* path: "example.realm"
* });
* ```
*
* This is only implemented for React Native.
*
* @throws {Error} If an I/O error occured or method is not implemented.
*/
static copyBundledRealmFiles() {}
Expand Down
24 changes: 23 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,29 @@ declare class Realm {
static deleteFile(config: Realm.Configuration): void;

/**
* Copy all bundled Realm files to app's default file folder.
* Copy any Realm files (i.e. `*.realm`) bundled with the application from the application
* directory into the application's documents directory, so that they can be opened and used
* by Realm. If the file already exists in the documents directory, it will not be
* overwritten, so this can safely be called multiple times.
*
* This should be called before opening the Realm, in order to move the bundled Realm
* files into a place where they can be written to, for example:
*
* ```
* // Given a bundled file, example.realm, this will copy example.realm (and any other .realm files)
* // from the app bundle into the app's documents directory. If the file already exists, it will
* // not be overwritten, so it is safe to call this every time the app starts.
* Realm.copyBundledRealmFiles();
*
* const realm = await Realm.open({
* // This will open example.realm from the documents directory, with the bundled data in.
* path: "example.realm"
* });
* ```
*
* This is only implemented for React Native.
*
* @throws {Error} If an I/O error occured or method is not implemented.
*/
static copyBundledRealmFiles(): void;

Expand Down