@datastream/indexeddb
Advanced tools
+23
| // Copyright 2026 will Farrell, and datastream contributors. | ||
| // SPDX-License-Identifier: MIT | ||
| import type { StreamOptions } from "@datastream/core"; | ||
| export { openDB as indexedDBConnect } from "idb"; | ||
| export function indexedDBReadStream( | ||
| options: { | ||
| db: unknown; | ||
| store: string; | ||
| index?: string; | ||
| key?: IDBKeyRange | IDBValidKey; | ||
| }, | ||
| streamOptions?: StreamOptions, | ||
| ): Promise<unknown>; | ||
| export function indexedDBWriteStream( | ||
| options: { | ||
| db: unknown; | ||
| store: string; | ||
| }, | ||
| streamOptions?: StreamOptions, | ||
| ): Promise<unknown>; |
+52
| <div align="center"> | ||
| <h1><datastream> `indexeddb`</h1> | ||
| <img alt="datastream logo" src="https://raw.githubusercontent.com/willfarrell/datastream/main/docs/img/datastream-logo.svg"/> | ||
| <p><strong>IndexedDB streams.</strong></p> | ||
| <p> | ||
| <a href="https://github.com/willfarrell/datastream/actions/workflows/test-unit.yml"><img src="https://github.com/willfarrell/datastream/actions/workflows/test-unit.yml/badge.svg" alt="GitHub Actions unit test status"></a> | ||
| <a href="https://github.com/willfarrell/datastream/actions/workflows/test-dast.yml"><img src="https://github.com/willfarrell/datastream/actions/workflows/test-dast.yml/badge.svg" alt="GitHub Actions dast test status"></a> | ||
| <a href="https://github.com/willfarrell/datastream/actions/workflows/test-perf.yml"><img src="https://github.com/willfarrell/datastream/actions/workflows/test-perf.yml/badge.svg" alt="GitHub Actions perf test status"></a> | ||
| <a href="https://github.com/willfarrell/datastream/actions/workflows/test-sast.yml"><img src="https://github.com/willfarrell/datastream/actions/workflows/test-sast.yml/badge.svg" alt="GitHub Actions SAST test status"></a> | ||
| <a href="https://github.com/willfarrell/datastream/actions/workflows/test-lint.yml"><img src="https://github.com/willfarrell/datastream/actions/workflows/test-lint.yml/badge.svg" alt="GitHub Actions lint test status"></a> | ||
| <br/> | ||
| <a href="https://www.npmjs.com/package/@datastream/indexeddb"><img alt="npm version" src="https://img.shields.io/npm/v/@datastream/indexeddb.svg"></a> | ||
| <a href="https://packagephobia.com/result?p=@datastream/indexeddb"><img src="https://packagephobia.com/badge?p=@datastream/indexeddb" alt="npm install size"></a> | ||
| <a href="https://www.npmjs.com/package/@datastream/indexeddb"> | ||
| <img alt="npm weekly downloads" src="https://img.shields.io/npm/dw/@datastream/indexeddb.svg"></a> | ||
| <a href="https://www.npmjs.com/package/@datastream/indexeddb#provenance"> | ||
| <img alt="npm provenance" src="https://img.shields.io/badge/provenance-Yes-brightgreen"></a> | ||
| <br/> | ||
| <a href="https://scorecard.dev/viewer/?uri=github.com/willfarrell/datastream"><img src="https://api.scorecard.dev/projects/github.com/willfarrell/datastream/badge" alt="Open Source Security Foundation (OpenSSF) Scorecard"></a> | ||
| <a href="https://slsa.dev"><img src="https://slsa.dev/images/gh-badge-level3.svg" alt="SLSA 3"></a> | ||
| <a href="https://github.com/willfarrell/datastream/blob/main/docs/CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg"></a> | ||
| <a href="https://biomejs.dev"><img alt="Checked with Biome" src="https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=flat&logo=biome"></a> | ||
| <a href="https://conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white"></a> | ||
| <a href="https://github.com/willfarrell/datastream/blob/main/package.json#L32"> | ||
| <img alt="code coverage" src="https://img.shields.io/badge/code%20coverage-95%25-brightgreen"></a> | ||
| </p> | ||
| <p>You can read the documentation at: <a href="https://datastream.js.org">https://datastream.js.org</a></p> | ||
| </div> | ||
| ## Install | ||
| To install datastream you can use NPM: | ||
| ```bash | ||
| npm install --save @datastream/indexeddb | ||
| ``` | ||
| ## Documentation and examples | ||
| For documentation and examples, refer to the main [datastream monorepo on GitHub](https://github.com/willfarrell/datastream) or [datastream official website](https://datastream.js.org). | ||
| ## Contributing | ||
| Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/willfarrell/datastream/issues) or to [submit Pull Requests](https://github.com/willfarrell/datastream/pulls). | ||
| ## License | ||
| Licensed under [MIT License](LICENSE). Copyright (c) 2026 [will Farrell](https://github.com/willfarrell), and [datastream contributors](https://github.com/willfarrell/datastream/graphs/contributors). |
+2
-2
@@ -1,5 +0,5 @@ | ||
| const indexedDBReadStream = async (_option, _streamOptions = {}) => { | ||
| const indexedDBReadStream = async (_options = {}, _streamOptions = {}) => { | ||
| throw new Error("indexedDBReadStream: Not supported"); | ||
| }; | ||
| const indexedDBWriteStream = async (_options, _streamOptions = {}) => { | ||
| const indexedDBWriteStream = async (_options = {}, _streamOptions = {}) => { | ||
| throw new Error("indexedDBWriteStream: Not supported"); | ||
@@ -6,0 +6,0 @@ }; |
| { | ||
| "version": 3, | ||
| "sources": ["index.node.js"], | ||
| "sourcesContent": ["export const indexedDBReadStream = async (_option, _streamOptions = {}) => {\n\tthrow new Error(\"indexedDBReadStream: Not supported\");\n};\n\nexport const indexedDBWriteStream = async (_options, _streamOptions = {}) => {\n\tthrow new Error(\"indexedDBWriteStream: Not supported\");\n};\n\nexport default {\n\treadStream: indexedDBReadStream,\n\twriteStream: indexedDBWriteStream,\n};\n"], | ||
| "mappings": "AAAO,MAAM,sBAAsB,OAAO,SAAS,iBAAiB,CAAC,MAAM;AAC1E,QAAM,IAAI,MAAM,oCAAoC;AACrD;AAEO,MAAM,uBAAuB,OAAO,UAAU,iBAAiB,CAAC,MAAM;AAC5E,QAAM,IAAI,MAAM,qCAAqC;AACtD;AAEA,IAAO,qBAAQ;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AACd;", | ||
| "sourcesContent": ["// Copyright 2026 will Farrell, and datastream contributors.\n// SPDX-License-Identifier: MIT\nexport const indexedDBReadStream = async (\n\t_options = {},\n\t_streamOptions = {},\n) => {\n\tthrow new Error(\"indexedDBReadStream: Not supported\");\n};\n\nexport const indexedDBWriteStream = async (\n\t_options = {},\n\t_streamOptions = {},\n) => {\n\tthrow new Error(\"indexedDBWriteStream: Not supported\");\n};\n\nexport default {\n\treadStream: indexedDBReadStream,\n\twriteStream: indexedDBWriteStream,\n};\n"], | ||
| "mappings": "AAEO,MAAM,sBAAsB,OAClC,WAAW,CAAC,GACZ,iBAAiB,CAAC,MACd;AACJ,QAAM,IAAI,MAAM,oCAAoC;AACrD;AAEO,MAAM,uBAAuB,OACnC,WAAW,CAAC,GACZ,iBAAiB,CAAC,MACd;AACJ,QAAM,IAAI,MAAM,qCAAqC;AACtD;AAEA,IAAO,qBAAQ;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AACd;", | ||
| "names": [] | ||
| } |
+3
-3
@@ -1,3 +0,3 @@ | ||
| import { createReadableStream, createWriteStream } from "@datastream/core"; | ||
| import { openDB } from "idb/with-async-ittr"; | ||
| import { createReadableStream, createWritableStream } from "@datastream/core"; | ||
| import { openDB } from "idb"; | ||
| const indexedDBConnect = openDB; | ||
@@ -19,3 +19,3 @@ const indexedDBReadStream = async ({ db, store, index, key }, streamOptions = {}) => { | ||
| }; | ||
| return createWriteStream(write, final, streamOptions); | ||
| return createWritableStream(write, final, streamOptions); | ||
| }; | ||
@@ -22,0 +22,0 @@ var index_web_default = { |
| { | ||
| "version": 3, | ||
| "sources": ["index.web.js"], | ||
| "sourcesContent": ["import { createReadableStream, createWriteStream } from \"@datastream/core\";\nimport { openDB } from \"idb/with-async-ittr\";\n\nexport const indexedDBConnect = openDB;\n\nexport const indexedDBReadStream = async (\n\t{ db, store, index, key },\n\tstreamOptions = {},\n) => {\n\tconst input = db.transaction(store).store;\n\tif (index && key) {\n\t\tinput.index(index).iterate(key);\n\t}\n\treturn createReadableStream(input, streamOptions);\n};\n\nexport const indexedDBWriteStream = async (\n\t{ db, store },\n\tstreamOptions = {},\n) => {\n\tconst tx = db.transaction(store, \"readwrite\");\n\tconst write = async (chunk) => {\n\t\tawait tx.store.add(chunk);\n\t};\n\tconst final = async () => {\n\t\tawait tx.done;\n\t};\n\treturn createWriteStream(write, final, streamOptions);\n};\n\nexport default {\n\tconnect: indexedDBConnect,\n\treadStream: indexedDBReadStream,\n\twriteStream: indexedDBWriteStream,\n};\n"], | ||
| "mappings": "AAAA,SAAS,sBAAsB,yBAAyB;AACxD,SAAS,cAAc;AAEhB,MAAM,mBAAmB;AAEzB,MAAM,sBAAsB,OAClC,EAAE,IAAI,OAAO,OAAO,IAAI,GACxB,gBAAgB,CAAC,MACb;AACJ,QAAM,QAAQ,GAAG,YAAY,KAAK,EAAE;AACpC,MAAI,SAAS,KAAK;AACjB,UAAM,MAAM,KAAK,EAAE,QAAQ,GAAG;AAAA,EAC/B;AACA,SAAO,qBAAqB,OAAO,aAAa;AACjD;AAEO,MAAM,uBAAuB,OACnC,EAAE,IAAI,MAAM,GACZ,gBAAgB,CAAC,MACb;AACJ,QAAM,KAAK,GAAG,YAAY,OAAO,WAAW;AAC5C,QAAM,QAAQ,OAAO,UAAU;AAC9B,UAAM,GAAG,MAAM,IAAI,KAAK;AAAA,EACzB;AACA,QAAM,QAAQ,YAAY;AACzB,UAAM,GAAG;AAAA,EACV;AACA,SAAO,kBAAkB,OAAO,OAAO,aAAa;AACrD;AAEA,IAAO,oBAAQ;AAAA,EACd,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,aAAa;AACd;", | ||
| "sourcesContent": ["// Copyright 2026 will Farrell, and datastream contributors.\n// SPDX-License-Identifier: MIT\nimport { createReadableStream, createWritableStream } from \"@datastream/core\";\nimport { openDB } from \"idb\";\n\nexport const indexedDBConnect = openDB;\n\nexport const indexedDBReadStream = async (\n\t{ db, store, index, key },\n\tstreamOptions = {},\n) => {\n\tconst input = db.transaction(store).store;\n\tif (index && key) {\n\t\tinput.index(index).iterate(key);\n\t}\n\treturn createReadableStream(input, streamOptions);\n};\n\nexport const indexedDBWriteStream = async (\n\t{ db, store },\n\tstreamOptions = {},\n) => {\n\tconst tx = db.transaction(store, \"readwrite\");\n\tconst write = async (chunk) => {\n\t\tawait tx.store.add(chunk);\n\t};\n\tconst final = async () => {\n\t\tawait tx.done;\n\t};\n\treturn createWritableStream(write, final, streamOptions);\n};\n\nexport default {\n\tconnect: indexedDBConnect,\n\treadStream: indexedDBReadStream,\n\twriteStream: indexedDBWriteStream,\n};\n"], | ||
| "mappings": "AAEA,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,cAAc;AAEhB,MAAM,mBAAmB;AAEzB,MAAM,sBAAsB,OAClC,EAAE,IAAI,OAAO,OAAO,IAAI,GACxB,gBAAgB,CAAC,MACb;AACJ,QAAM,QAAQ,GAAG,YAAY,KAAK,EAAE;AACpC,MAAI,SAAS,KAAK;AACjB,UAAM,MAAM,KAAK,EAAE,QAAQ,GAAG;AAAA,EAC/B;AACA,SAAO,qBAAqB,OAAO,aAAa;AACjD;AAEO,MAAM,uBAAuB,OACnC,EAAE,IAAI,MAAM,GACZ,gBAAgB,CAAC,MACb;AACJ,QAAM,KAAK,GAAG,YAAY,OAAO,WAAW;AAC5C,QAAM,QAAQ,OAAO,UAAU;AAC9B,UAAM,GAAG,MAAM,IAAI,KAAK;AAAA,EACzB;AACA,QAAM,QAAQ,YAAY;AACzB,UAAM,GAAG;AAAA,EACV;AACA,SAAO,qBAAqB,OAAO,OAAO,aAAa;AACxD;AAEA,IAAO,oBAAQ;AAAA,EACd,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,aAAa;AACd;", | ||
| "names": [] | ||
| } |
+7
-13
| { | ||
| "name": "@datastream/indexeddb", | ||
| "version": "0.0.42", | ||
| "description": "", | ||
| "version": "0.1.4", | ||
| "description": "IndexedDB readable and writable streams for browser storage", | ||
| "type": "module", | ||
@@ -13,3 +13,3 @@ "engines": { | ||
| }, | ||
| "main": "./index.web.mjs", | ||
| "main": "./index.node.mjs", | ||
| "module": "./index.web.mjs", | ||
@@ -22,6 +22,2 @@ "exports": { | ||
| "default": "./index.node.mjs" | ||
| }, | ||
| "__require": { | ||
| "types": "./index.d.ts", | ||
| "default": "./index.node.cjs" | ||
| } | ||
@@ -42,3 +38,2 @@ }, | ||
| "*.mjs", | ||
| "*.cjs", | ||
| "*.map", | ||
@@ -64,3 +59,3 @@ "*.d.ts" | ||
| "url": "github:willfarrell/datastream", | ||
| "directory": "packages/digest" | ||
| "directory": "packages/indexeddb" | ||
| }, | ||
@@ -72,6 +67,5 @@ "bugs": { | ||
| "dependencies": { | ||
| "@datastream/core": "0.0.42", | ||
| "@datastream/indexeddb": "0.0.42" | ||
| }, | ||
| "gitHead": "6ddc0fadabf5f3702a51aebae1fc6b252c6ae8d4" | ||
| "@datastream/core": "0.1.4", | ||
| "idb": "8.0.3" | ||
| } | ||
| } |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
9750
88.66%7
40%66
43.48%1
-50%52
Infinity%+ Added
+ Added
+ Added
- Removed
- Removed
Updated