@budarin/psw-plugin-opfs-serve-range 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.ru.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Large media files and other heavy assets are almost always requested in chunks v
|
|
|
14
14
|
|
|
15
15
|
This package takes a different approach: it uses the Origin Private File System (OPFS) as the primary storage for large resources and range responses. Files are stored in OPFS in a custom format (one file per URL plus a metadata footer), and ranges are read directly from the file system instead of Cache API. On top of that, the package provides plugins for precaching, background downloads, and serving range requests.
|
|
16
16
|
|
|
17
|
-
Unlike `@budarin/psw-plugin-serve-range-requests`, which
|
|
17
|
+
Unlike `@budarin/psw-plugin-serve-range-requests`, which uses the Cache API: cached data can only be read **sequentially**, with no random access, so serving a range at the end or in the middle of a large file requires reading everything from the start up to that point. This package uses OPFS: the requested range is read directly from the file (random access), with no need to read preceding bytes — any part of the file is equally fast to access. In addition, you control quota and eviction (limits, LRU, pinned resources, tab notifications), “download in background, then use offline” is supported (Background Fetch, precache), and utilities are provided for your own OPFS read/write plugins.
|
|
18
18
|
|
|
19
19
|
### What this package provides
|
|
20
20
|
|
package/README.ru.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Этот пакет решает задачу по‑другому: он использует Origin Private File System (OPFS) как основное хранилище для больших ресурсов и ответов по Range. Файлы записываются в OPFS в собственном формате (один файл на URL плюс метаданные во футере), а диапазоны читаются напрямую из файловой системы, без Cache API. Поверх этого построены плагины для предзагрузки, фоновых загрузок и обслуживания range‑запросов.
|
|
6
6
|
|
|
7
|
-
В отличие от
|
|
7
|
+
В отличие от `@budarin/psw-plugin-serve-range-requests`, который работает поверх Cache API: там данные читаются из кеша **только последовательно**, без произвольного доступа, поэтому запрос диапазона в конце или в середине большого файла заставляет читать всё от начала до нужного места. Этот пакет использует OPFS: нужный диапазон читается напрямую из файла (произвольный доступ), без прохода по предыдущим байтам — обращение к любой части файла одинаково быстро. Кроме того, квотой и эвикцией управляете вы (лимиты, LRU, закреплённые ресурсы, уведомления вкладок), поддерживаются сценарии «скачать в фоне — потом смотреть офлайн» (Background Fetch, precache) и есть утилиты для своих плагинов записи и чтения из OPFS.
|
|
8
8
|
|
|
9
9
|
Пакет предоставляет плагины и утилиты для [@budarin/pluggable-serviceworker](https://www.npmjs.com/package/@budarin/pluggable-serviceworker) для обработки range‑запросов к файлам в OPFS:
|
|
10
10
|
|