You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sites/cheerpx/src/content/docs/12-reference/CheerpX.OverlayDevice/create.md
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: create
3
-
description: Virtual filesystems and how to use them
3
+
description: Create a writable persistent overlay device on top of another block device.
4
4
---
5
5
6
6
```ts
@@ -16,3 +16,39 @@ namespace CheerpX {
16
16
-**baseDevice (`Device`)** - The underlying device (e.g., `HttpBytesDevice`, `IDBDevice`) that serves as the base layer for the filesystem.
17
17
18
18
-**overlayDevice (`Device`)** - The writable layer that will overlay the base device, enabling persistent changes.
19
+
20
+
## Returns
21
+
22
+
`CheerpX.OverlayDevice.create` returns a [Promise] that resolves to an instance of the `OverlayDevice`. The `OverlayDevice` allows you to overlay a writable layer on top of the base device, enabling persistent changes while still accessing the base data.
23
+
24
+
## Example
25
+
26
+
Create an `OverlayDevice` instance to combine a `HttpBytesDevice` for streaming data from an HTTP source and an `IDBDevice` for caching and persistent local storage.
27
+
28
+
```ts {8, 12}
29
+
// Create a read-only HttpBytesDevice for streaming disk blocks via HTTP
In this example, the `OverlayDevice` provides a writable layer on top of the `HttpBytesDevice` (which serves as a read-only block device for streaming), allowing changes to be stored locally via the `IDBDevice`.
44
+
45
+
<!-- Add links when rest of the references are added -->
46
+
<!-- ## Related sources
47
+
48
+
- [Cheerp.HttpBytesDevice.create]()
49
+
- [Cheerp.IDBDevice.create]()
50
+
- [Cheerp.Linux.create]() -->
51
+
52
+
For more information, please check out the [Files and File system guide](/docs/guides/File-System-support). This guide provides more details on how to work with files and directories in CheerpX.
0 commit comments