{"_id":"@budibase/pouchdb-replication-stream","_rev":"9-846350e2edc3b62254a140e0c339cf39","name":"@budibase/pouchdb-replication-stream","dist-tags":{"latest":"1.2.11"},"versions":{"1.2.10":{"name":"@budibase/pouchdb-replication-stream","version":"1.2.10","keywords":["pouch","pouchdb","plugin","stream","replication","couch","couchdb"],"author":{},"license":"Apache-2.0","_id":"@budibase/pouchdb-replication-stream@1.2.10","maintainers":[{"name":"mike_chuckles","email":"me@michaeldrury.co.uk"},{"name":"shogunpurple","email":"martin@budibase.com"}],"bugs":{"url":"https://github.com/nolanlawson/pouchdb-replication-stream/issues"},"dist":{"shasum":"4100df2effd7c823edadddcdbdc380f6827eebf5","tarball":"https://registry.npmjs.org/@budibase/pouchdb-replication-stream/-/pouchdb-replication-stream-1.2.10.tgz","fileCount":26,"integrity":"sha512-1zeorOwbelZ7HF5vFB+pKE8Mnh31om8k1M6T3AZXVULYTHLsyJrMTozSv5CJ1P8ZfOIJab09HDzCXDh2icFekg==","signatures":[{"sig":"MEYCIQCB9nDL8H4SiTBvanA+DFi+7QGoMFBnf7SoZl1q3/WH1AIhALN+vAkVBgm8lNCJaaqmJdG/pDC+u5sL0rkG7tVb1bC5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":430113,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4SVHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoo1w/+McQwmPo4Fcxcxhh75dkvUHStLB+0Mn59GFDtNh36GRrK1LjB\r\nqXiPAAPkQ0fSUGK6ynbNrnIKNTjt0fcFs6ir/a3wrDojuwpK9Zjm2wuPBtg9\r\nB/E4PACulEeRryH0Rqhgv2ppMx7eK4kG2lBauQ1iVuGMDKdKaV1nSbmzMgeE\r\n/1VhXEKkDUMMIx90xI5muiQ4d80iOjvlojOvKdbSq3KCi38xfgnSH28NERB8\r\n8yRGlyqYWAEFT9wiAkfl+iAiVz5qfYHqTqon/yeOHb0NDn9XUKzi3Yn15lDr\r\nXEm5z/Nxx1FQWrkdxFDuCYz0t1sJ5SDvh/Chvh/vYgDUIlCDGNSRXXzjuScB\r\nL5qfzew/J5K+Yiv/K9qUe1VyPNXL/+hedGp8lUUA0F3SCOqK11TXBW8ehR8O\r\n1kDTkcqRubWapuv/RG1DMhdmrtGN3skISnK9mGabjMVeziTmmzeqtbdIDTTZ\r\nlSstdlXoC40EI1rls15ersUcbJfzMbDvJgO4wlGG2p5jitj/as6FFAF96kxw\r\nZecU6IvAYZWx75hyQ6Xb/VsqgmU+pax/Y7IW31EfOo97t/tm8X+E3u329BEo\r\nsQZ+m9GdcXDB8FvM4X4CmclOa91pRzEZ9TOvJX7Qc3NoZkacp2pXeFFYH8D3\r\ncpFzl7bUlj+D1cpNRKjTGobgCyl7ZWN/mOY=\r\n=5uAO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","scripts":{"dev":"browserify test/test.js > test/test-bundle.js && npm run dev-server","min":"uglifyjs dist/pouchdb.replication-stream.js -mc > dist/pouchdb.replication-stream.min.js","test":"npm run jshint && ./bin/run-test.sh","build":"mkdirp dist && npm run browserify && npm run min","jshint":"jshint -c .jshintrc lib test/test.js","coverage":"npm test --coverage && istanbul check-coverage --lines 100 --function 100 --statements 100 --branches 100","test-node":"TEST_DB=testdb,http://localhost:5984/testdb istanbul test ./node_modules/mocha/bin/_mocha test/test.js -- -R spec","browserify":"browserify -p bundle-collapser/plugin -s PouchReplicationStream . | ./bin/es3ify.js | derequire > dist/pouchdb.replication-stream.js","dev-server":"./bin/dev-server.js","test-browser":"./bin/test-browser.js"},"_npmUser":{"name":"mike_chuckles","email":"me@michaeldrury.co.uk"},"repository":{"url":"git://github.com/nolanlawson/pouchdb-replication-stream.git","type":"git"},"description":"PouchDB/CouchDB replication as a stream","directories":{},"licenseText":"\n                                Apache License\n                          Version 2.0, January 2004\n                       http://www.apache.org/licenses/\n\n  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n  1. Definitions.\n\n     \"License\" shall mean the terms and conditions for use, reproduction,\n     and distribution as defined by Sections 1 through 9 of this document.\n\n     \"Licensor\" shall mean the copyright owner or entity authorized by\n     the copyright owner that is granting the License.\n\n     \"Legal Entity\" shall mean the union of the acting entity and all\n     other entities that control, are controlled by, or are under common\n     control with that entity. For the purposes of this definition,\n     \"control\" means (i) the power, direct or indirect, to cause the\n     direction or management of such entity, whether by contract or\n     otherwise, or (ii) ownership of fifty percent (50%) or more of the\n     outstanding shares, or (iii) beneficial ownership of such entity.\n\n     \"You\" (or \"Your\") shall mean an individual or Legal Entity\n     exercising permissions granted by this License.\n\n     \"Source\" form shall mean the preferred form for making modifications,\n     including but not limited to software source code, documentation\n     source, and configuration files.\n\n     \"Object\" form shall mean any form resulting from mechanical\n     transformation or translation of a Source form, including but\n     not limited to compiled object code, generated documentation,\n     and conversions to other media types.\n\n     \"Work\" shall mean the work of authorship, whether in Source or\n     Object form, made available under the License, as indicated by a\n     copyright notice that is included in or attached to the work\n     (an example is provided in the Appendix below).\n\n     \"Derivative Works\" shall mean any work, whether in Source or Object\n     form, that is based on (or derived from) the Work and for which the\n     editorial revisions, annotations, elaborations, or other modifications\n     represent, as a whole, an original work of authorship. For the purposes\n     of this License, Derivative Works shall not include works that remain\n     separable from, or merely link (or bind by name) to the interfaces of,\n     the Work and Derivative Works thereof.\n\n     \"Contribution\" shall mean any work of authorship, including\n     the original version of the Work and any modifications or additions\n     to that Work or Derivative Works thereof, that is intentionally\n     submitted to Licensor for inclusion in the Work by the copyright owner\n     or by an individual or Legal Entity authorized to submit on behalf of\n     the copyright owner. For the purposes of this definition, \"submitted\"\n     means any form of electronic, verbal, or written communication sent\n     to the Licensor or its representatives, including but not limited to\n     communication on electronic mailing lists, source code control systems,\n     and issue tracking systems that are managed by, or on behalf of, the\n     Licensor for the purpose of discussing and improving the Work, but\n     excluding communication that is conspicuously marked or otherwise\n     designated in writing by the copyright owner as \"Not a Contribution.\"\n\n     \"Contributor\" shall mean Licensor and any individual or Legal Entity\n     on behalf of whom a Contribution has been received by Licensor and\n     subsequently incorporated within the Work.\n\n  2. Grant of Copyright License. Subject to the terms and conditions of\n     this License, each Contributor hereby grants to You a perpetual,\n     worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n     copyright license to reproduce, prepare Derivative Works of,\n     publicly display, publicly perform, sublicense, and distribute the\n     Work and such Derivative Works in Source or Object form.\n\n  3. Grant of Patent License. Subject to the terms and conditions of\n     this License, each Contributor hereby grants to You a perpetual,\n     worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n     (except as stated in this section) patent license to make, have made,\n     use, offer to sell, sell, import, and otherwise transfer the Work,\n     where such license applies only to those patent claims licensable\n     by such Contributor that are necessarily infringed by their\n     Contribution(s) alone or by combination of their Contribution(s)\n     with the Work to which such Contribution(s) was submitted. If You\n     institute patent litigation against any entity (including a\n     cross-claim or counterclaim in a lawsuit) alleging that the Work\n     or a Contribution incorporated within the Work constitutes direct\n     or contributory patent infringement, then any patent licenses\n     granted to You under this License for that Work shall terminate\n     as of the date such litigation is filed.\n\n  4. Redistribution. You may reproduce and distribute copies of the\n     Work or Derivative Works thereof in any medium, with or without\n     modifications, and in Source or Object form, provided that You\n     meet the following conditions:\n\n     (a) You must give any other recipients of the Work or\n         Derivative Works a copy of this License; and\n\n     (b) You must cause any modified files to carry prominent notices\n         stating that You changed the files; and\n\n     (c) You must retain, in the Source form of any Derivative Works\n         that You distribute, all copyright, patent, trademark, and\n         attribution notices from the Source form of the Work,\n         excluding those notices that do not pertain to any part of\n         the Derivative Works; and\n\n     (d) If the Work includes a \"NOTICE\" text file as part of its\n         distribution, then any Derivative Works that You distribute must\n         include a readable copy of the attribution notices contained\n         within such NOTICE file, excluding those notices that do not\n         pertain to any part of the Derivative Works, in at least one\n         of the following places: within a NOTICE text file distributed\n         as part of the Derivative Works; within the Source form or\n         documentation, if provided along with the Derivative Works; or,\n         within a display generated by the Derivative Works, if and\n         wherever such third-party notices normally appear. The contents\n         of the NOTICE file are for informational purposes only and\n         do not modify the License. You may add Your own attribution\n         notices within Derivative Works that You distribute, alongside\n         or as an addendum to the NOTICE text from the Work, provided\n         that such additional attribution notices cannot be construed\n         as modifying the License.\n\n     You may add Your own copyright statement to Your modifications and\n     may provide additional or different license terms and conditions\n     for use, reproduction, or distribution of Your modifications, or\n     for any such Derivative Works as a whole, provided Your use,\n     reproduction, and distribution of the Work otherwise complies with\n     the conditions stated in this License.\n\n  5. Submission of Contributions. Unless You explicitly state otherwise,\n     any Contribution intentionally submitted for inclusion in the Work\n     by You to the Licensor shall be under the terms and conditions of\n     this License, without any additional terms or conditions.\n     Notwithstanding the above, nothing herein shall supersede or modify\n     the terms of any separate license agreement you may have executed\n     with Licensor regarding such Contributions.\n\n  6. Trademarks. This License does not grant permission to use the trade\n     names, trademarks, service marks, or product names of the Licensor,\n     except as required for reasonable and customary use in describing the\n     origin of the Work and reproducing the content of the NOTICE file.\n\n  7. Disclaimer of Warranty. Unless required by applicable law or\n     agreed to in writing, Licensor provides the Work (and each\n     Contributor provides its Contributions) on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n     implied, including, without limitation, any warranties or conditions\n     of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n     PARTICULAR PURPOSE. You are solely responsible for determining the\n     appropriateness of using or redistributing the Work and assume any\n     risks associated with Your exercise of permissions under this License.\n\n  8. Limitation of Liability. In no event and under no legal theory,\n     whether in tort (including negligence), contract, or otherwise,\n     unless required by applicable law (such as deliberate and grossly\n     negligent acts) or agreed to in writing, shall any Contributor be\n     liable to You for damages, including any direct, indirect, special,\n     incidental, or consequential damages of any character arising as a\n     result of this License or out of the use or inability to use the\n     Work (including but not limited to damages for loss of goodwill,\n     work stoppage, computer failure or malfunction, or any and all\n     other commercial damages or losses), even if such Contributor\n     has been advised of the possibility of such damages.\n\n  9. Accepting Warranty or Additional Liability. While redistributing\n     the Work or Derivative Works thereof, You may choose to offer,\n     and charge a fee for, acceptance of support, warranty, indemnity,\n     or other liability obligations and/or rights consistent with this\n     License. However, in accepting such obligations, You may act only\n     on Your own behalf and on Your sole responsibility, not on behalf\n     of any other Contributor, and only if You agree to indemnify,\n     defend, and hold each Contributor harmless for any liability\n     incurred by, or claims asserted against, such Contributor by reason\n     of your accepting any such warranty or additional liability.\n\n  END OF TERMS AND CONDITIONS\n\n  APPENDIX: How to apply the Apache License to your work.\n\n     To apply the Apache License to your work, attach the following\n     boilerplate notice, with the fields enclosed by brackets \"[]\"\n     replaced with your own identifying information. (Don't include\n     the brackets!)  The text should be enclosed in the appropriate\n     comment syntax for the file format. We also recommend that a\n     file or class name and description of purpose be included on the\n     same \"printed page\" as the copyright notice for easier\n     identification within third-party archives.\n\n  Copyright [yyyy] [name of copyright owner]\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n","dependencies":{"ndjson":"^1.4.3","inherits":"^2.0.3","through2":"^2.0.0","argsarray":"0.0.1","lodash.pick":"^4.0.0","pouch-stream":"^0.4.0","pouchdb-promise":"^6.0.4"},"_hasShrinkwrap":false,"devDependencies":{"wd":"^0.2.21","lie":"^3.1.0","chai":"^3.3.0","noms":"0.0.0","mocha":"~1.18","es3ify":"^0.1.3","jshint":"^2.3.0","mkdirp":"^0.5.0","request":"^2.36.0","bluebird":"^1.0.7","istanbul":"^0.2.7","watchify":"^3.1.0","derequire":"^2.0.0","phantomjs":"^1.9.7-5","uglify-js":"^2.4.13","browserify":"^11.2.0","http-server":"~0.8.5","memorystream":"^0.3.0","pouchdb-memory":"^6.0.0","bundle-collapser":"^1.2.1","chai-as-promised":"^5.1.0","selenium-standalone":"3.0.2","random-document-stream":"0.0.0","sauce-connect-launcher":"^0.4.2"},"_npmOperationalInternal":{"tmp":"tmp/pouchdb-replication-stream_1.2.10_1675699527186_0.06887045291571647","host":"s3://npm-registry-packages"}},"1.2.11":{"name":"@budibase/pouchdb-replication-stream","version":"1.2.11","keywords":["pouch","pouchdb","plugin","stream","replication","couch","couchdb"],"author":{},"license":"Apache-2.0","_id":"@budibase/pouchdb-replication-stream@1.2.11","maintainers":[{"name":"mike_chuckles","email":"me@michaeldrury.co.uk"},{"name":"shogunpurple","email":"martin@budibase.com"}],"bugs":{"url":"https://github.com/nolanlawson/pouchdb-replication-stream/issues"},"dist":{"shasum":"b437584471f2cf6976fa690c338f432a3ecd24c9","tarball":"https://registry.npmjs.org/@budibase/pouchdb-replication-stream/-/pouchdb-replication-stream-1.2.11.tgz","fileCount":26,"integrity":"sha512-gHeMczCCIcxiv4EmG4uosHZvGIgInGwP8SaWKGY3g+m7XPdlM5UgRYhyPHqmOU9fdfTtR3LgAqED6NRWFYmqyw==","signatures":[{"sig":"MEUCIQDN9NxfnNcwiKHR3jCuHzLZorvaQkSSsxYlaqge50OkxAIgZ7KDgxlwz3x/3cKg///BIHspbnb6T6po/8lH9nMAe2c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":418189},"main":"lib/index.js","scripts":{"dev":"browserify test/test.js > test/test-bundle.js && npm run dev-server","min":"uglifyjs dist/pouchdb.replication-stream.js -mc > dist/pouchdb.replication-stream.min.js","test":"npm run jshint && ./bin/run-test.sh","build":"mkdirp dist && npm run browserify && npm run min","jshint":"jshint -c .jshintrc lib test/test.js","coverage":"npm test --coverage && istanbul check-coverage --lines 100 --function 100 --statements 100 --branches 100","test-node":"TEST_DB=testdb,http://localhost:5984/testdb istanbul test ./node_modules/mocha/bin/_mocha test/test.js -- -R spec","browserify":"browserify -p bundle-collapser/plugin -s PouchReplicationStream . | ./bin/es3ify.js | derequire > dist/pouchdb.replication-stream.js","dev-server":"./bin/dev-server.js","test-browser":"./bin/test-browser.js"},"_npmUser":{"name":"mike_chuckles","email":"me@michaeldrury.co.uk"},"repository":{"url":"git://github.com/nolanlawson/pouchdb-replication-stream.git","type":"git"},"description":"PouchDB/CouchDB replication as a stream","directories":{},"licenseText":"\n                                Apache License\n                          Version 2.0, January 2004\n                       http://www.apache.org/licenses/\n\n  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n  1. Definitions.\n\n     \"License\" shall mean the terms and conditions for use, reproduction,\n     and distribution as defined by Sections 1 through 9 of this document.\n\n     \"Licensor\" shall mean the copyright owner or entity authorized by\n     the copyright owner that is granting the License.\n\n     \"Legal Entity\" shall mean the union of the acting entity and all\n     other entities that control, are controlled by, or are under common\n     control with that entity. For the purposes of this definition,\n     \"control\" means (i) the power, direct or indirect, to cause the\n     direction or management of such entity, whether by contract or\n     otherwise, or (ii) ownership of fifty percent (50%) or more of the\n     outstanding shares, or (iii) beneficial ownership of such entity.\n\n     \"You\" (or \"Your\") shall mean an individual or Legal Entity\n     exercising permissions granted by this License.\n\n     \"Source\" form shall mean the preferred form for making modifications,\n     including but not limited to software source code, documentation\n     source, and configuration files.\n\n     \"Object\" form shall mean any form resulting from mechanical\n     transformation or translation of a Source form, including but\n     not limited to compiled object code, generated documentation,\n     and conversions to other media types.\n\n     \"Work\" shall mean the work of authorship, whether in Source or\n     Object form, made available under the License, as indicated by a\n     copyright notice that is included in or attached to the work\n     (an example is provided in the Appendix below).\n\n     \"Derivative Works\" shall mean any work, whether in Source or Object\n     form, that is based on (or derived from) the Work and for which the\n     editorial revisions, annotations, elaborations, or other modifications\n     represent, as a whole, an original work of authorship. For the purposes\n     of this License, Derivative Works shall not include works that remain\n     separable from, or merely link (or bind by name) to the interfaces of,\n     the Work and Derivative Works thereof.\n\n     \"Contribution\" shall mean any work of authorship, including\n     the original version of the Work and any modifications or additions\n     to that Work or Derivative Works thereof, that is intentionally\n     submitted to Licensor for inclusion in the Work by the copyright owner\n     or by an individual or Legal Entity authorized to submit on behalf of\n     the copyright owner. For the purposes of this definition, \"submitted\"\n     means any form of electronic, verbal, or written communication sent\n     to the Licensor or its representatives, including but not limited to\n     communication on electronic mailing lists, source code control systems,\n     and issue tracking systems that are managed by, or on behalf of, the\n     Licensor for the purpose of discussing and improving the Work, but\n     excluding communication that is conspicuously marked or otherwise\n     designated in writing by the copyright owner as \"Not a Contribution.\"\n\n     \"Contributor\" shall mean Licensor and any individual or Legal Entity\n     on behalf of whom a Contribution has been received by Licensor and\n     subsequently incorporated within the Work.\n\n  2. Grant of Copyright License. Subject to the terms and conditions of\n     this License, each Contributor hereby grants to You a perpetual,\n     worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n     copyright license to reproduce, prepare Derivative Works of,\n     publicly display, publicly perform, sublicense, and distribute the\n     Work and such Derivative Works in Source or Object form.\n\n  3. Grant of Patent License. Subject to the terms and conditions of\n     this License, each Contributor hereby grants to You a perpetual,\n     worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n     (except as stated in this section) patent license to make, have made,\n     use, offer to sell, sell, import, and otherwise transfer the Work,\n     where such license applies only to those patent claims licensable\n     by such Contributor that are necessarily infringed by their\n     Contribution(s) alone or by combination of their Contribution(s)\n     with the Work to which such Contribution(s) was submitted. If You\n     institute patent litigation against any entity (including a\n     cross-claim or counterclaim in a lawsuit) alleging that the Work\n     or a Contribution incorporated within the Work constitutes direct\n     or contributory patent infringement, then any patent licenses\n     granted to You under this License for that Work shall terminate\n     as of the date such litigation is filed.\n\n  4. Redistribution. You may reproduce and distribute copies of the\n     Work or Derivative Works thereof in any medium, with or without\n     modifications, and in Source or Object form, provided that You\n     meet the following conditions:\n\n     (a) You must give any other recipients of the Work or\n         Derivative Works a copy of this License; and\n\n     (b) You must cause any modified files to carry prominent notices\n         stating that You changed the files; and\n\n     (c) You must retain, in the Source form of any Derivative Works\n         that You distribute, all copyright, patent, trademark, and\n         attribution notices from the Source form of the Work,\n         excluding those notices that do not pertain to any part of\n         the Derivative Works; and\n\n     (d) If the Work includes a \"NOTICE\" text file as part of its\n         distribution, then any Derivative Works that You distribute must\n         include a readable copy of the attribution notices contained\n         within such NOTICE file, excluding those notices that do not\n         pertain to any part of the Derivative Works, in at least one\n         of the following places: within a NOTICE text file distributed\n         as part of the Derivative Works; within the Source form or\n         documentation, if provided along with the Derivative Works; or,\n         within a display generated by the Derivative Works, if and\n         wherever such third-party notices normally appear. The contents\n         of the NOTICE file are for informational purposes only and\n         do not modify the License. You may add Your own attribution\n         notices within Derivative Works that You distribute, alongside\n         or as an addendum to the NOTICE text from the Work, provided\n         that such additional attribution notices cannot be construed\n         as modifying the License.\n\n     You may add Your own copyright statement to Your modifications and\n     may provide additional or different license terms and conditions\n     for use, reproduction, or distribution of Your modifications, or\n     for any such Derivative Works as a whole, provided Your use,\n     reproduction, and distribution of the Work otherwise complies with\n     the conditions stated in this License.\n\n  5. Submission of Contributions. Unless You explicitly state otherwise,\n     any Contribution intentionally submitted for inclusion in the Work\n     by You to the Licensor shall be under the terms and conditions of\n     this License, without any additional terms or conditions.\n     Notwithstanding the above, nothing herein shall supersede or modify\n     the terms of any separate license agreement you may have executed\n     with Licensor regarding such Contributions.\n\n  6. Trademarks. This License does not grant permission to use the trade\n     names, trademarks, service marks, or product names of the Licensor,\n     except as required for reasonable and customary use in describing the\n     origin of the Work and reproducing the content of the NOTICE file.\n\n  7. Disclaimer of Warranty. Unless required by applicable law or\n     agreed to in writing, Licensor provides the Work (and each\n     Contributor provides its Contributions) on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n     implied, including, without limitation, any warranties or conditions\n     of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n     PARTICULAR PURPOSE. You are solely responsible for determining the\n     appropriateness of using or redistributing the Work and assume any\n     risks associated with Your exercise of permissions under this License.\n\n  8. Limitation of Liability. In no event and under no legal theory,\n     whether in tort (including negligence), contract, or otherwise,\n     unless required by applicable law (such as deliberate and grossly\n     negligent acts) or agreed to in writing, shall any Contributor be\n     liable to You for damages, including any direct, indirect, special,\n     incidental, or consequential damages of any character arising as a\n     result of this License or out of the use or inability to use the\n     Work (including but not limited to damages for loss of goodwill,\n     work stoppage, computer failure or malfunction, or any and all\n     other commercial damages or losses), even if such Contributor\n     has been advised of the possibility of such damages.\n\n  9. Accepting Warranty or Additional Liability. While redistributing\n     the Work or Derivative Works thereof, You may choose to offer,\n     and charge a fee for, acceptance of support, warranty, indemnity,\n     or other liability obligations and/or rights consistent with this\n     License. However, in accepting such obligations, You may act only\n     on Your own behalf and on Your sole responsibility, not on behalf\n     of any other Contributor, and only if You agree to indemnify,\n     defend, and hold each Contributor harmless for any liability\n     incurred by, or claims asserted against, such Contributor by reason\n     of your accepting any such warranty or additional liability.\n\n  END OF TERMS AND CONDITIONS\n\n  APPENDIX: How to apply the Apache License to your work.\n\n     To apply the Apache License to your work, attach the following\n     boilerplate notice, with the fields enclosed by brackets \"[]\"\n     replaced with your own identifying information. (Don't include\n     the brackets!)  The text should be enclosed in the appropriate\n     comment syntax for the file format. We also recommend that a\n     file or class name and description of purpose be included on the\n     same \"printed page\" as the copyright notice for easier\n     identification within third-party archives.\n\n  Copyright [yyyy] [name of copyright owner]\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n","dependencies":{"ndjson":"^1.4.3","inherits":"^2.0.3","through2":"^2.0.0","pouch-stream":"^0.4.0","pouchdb-promise":"^6.0.4"},"_hasShrinkwrap":false,"devDependencies":{"wd":"^0.2.21","lie":"^3.1.0","chai":"^3.3.0","noms":"0.0.0","mocha":"~1.18","es3ify":"^0.1.3","jshint":"^2.3.0","mkdirp":"^0.5.0","request":"^2.36.0","bluebird":"^1.0.7","istanbul":"^0.2.7","watchify":"^3.1.0","derequire":"^2.0.0","phantomjs":"^1.9.7-5","uglify-js":"^2.4.13","browserify":"^11.2.0","http-server":"~0.8.5","memorystream":"^0.3.0","pouchdb-memory":"^6.0.0","bundle-collapser":"^1.2.1","chai-as-promised":"^5.1.0","selenium-standalone":"3.0.2","random-document-stream":"0.0.0","sauce-connect-launcher":"^0.4.2"},"_npmOperationalInternal":{"tmp":"tmp/pouchdb-replication-stream_1.2.11_1717597913653_0.568972338821153","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-02-06T16:05:27.186Z","modified":"2026-08-17T10:37:35.347Z","1.2.10":"2023-02-06T16:05:27.358Z","1.2.11":"2024-06-05T14:31:53.815Z"},"bugs":{"url":"https://github.com/nolanlawson/pouchdb-replication-stream/issues"},"author":{},"license":"Apache-2.0","keywords":["pouch","pouchdb","plugin","stream","replication","couch","couchdb"],"repository":{"url":"git://github.com/nolanlawson/pouchdb-replication-stream.git","type":"git"},"description":"PouchDB/CouchDB replication as a stream","maintainers":[{"email":"mel@budibase.com","name":"melbudibase"},{"email":"joe@budibase.com","name":"joranamo"},{"email":"christos@budibase.com","name":"christos-budibase"},{"email":"adria@budibase.com","name":"adri.bb"}],"readme":"PouchDB Replication Stream\n=====\n\n[![Build Status](https://travis-ci.org/nolanlawson/pouchdb-replication-stream.svg)](https://travis-ci.org/nolanlawson/pouchdb-replication-stream)\n\n`ReadableStream`s and `WritableStream`s for PouchDB/CouchDB replication.\n\nBasically, you can replicate two databases by just attaching the streams together.\n\nThis has many uses:\n\n1. Dump a database to a file, and then load that same file into another database.\n2. Do a quick initial replication by dumping the contents of a CouchDB to an HTTP endpoint, which is then loaded into a PouchDB in the browser.\n3. Replicate over web sockets? Over bluetooth? Over NFC? Why not? Since the replication stream is just JSON plaintext, you can send it over any transport mechanism.\n4. Periodically backup your database.\n\nSuite of Tools\n---------\n\n* [pouchdb-dump-cli](https://github.com/nolanlawson/pouchdb-dump-cli)\n* [pouchdb-load](https://github.com/nolanlawson/pouchdb-load)\n* [express-pouchdb-replication-stream](https://github.com/conor-mac-aoidh/express-pouchdb-replication-stream)\n\nExamples\n------\n\nYou can use `pouchdb-replication-stream` itself to:\n  * [dump to a string](#dumping-to-a-string)\n  * [replicate with in-memory streams](https://github.com/nolanlawson/pouchdb-replication-stream#stream-directly-without-the-dump-file)\n  * do anything you can do with streams :)\n\nUsage\n-------\n\nLet's assume you have two databases. It doesn't matter whether they're remote or local:\n\n```js\nvar db1 = new PouchDB('mydb');\nvar db2 = new PouchDB('http://localhost:5984/mydb');\n```\n\nLet's dump the entire contents of db1 to a file using `dump()`:\n\n```js\nvar ws = fs.createWriteStream('output.txt');\n\ndb1.dump(ws).then(function (res) {\n  // res should be {ok: true}\n});\n```\n\nNow let's read that file into another database using `load()`:\n\n```js\nvar rs = fs.createReadStream('output.txt');\n\ndb2.load(rs).then(function (res) {\n  // res should be {ok: true}\n});\n```\n\nCongratulations, your databases are now in sync. It's the same effect as if you had done:\n\n```js\ndb1.replicate.to(db2);\n```\n\nAPI\n-----\n\n### db.dump(stream [, opts])\n\nDump the `db` to a `stream` with the given `opts`. Returns a Promise.\n\nThe `opts` are passed directly to the `replicate()` API [as described here](http://pouchdb.com/api.html#replication). In particular you may want to set:\n\n* `batch_size` - how many documents to dump in each output chunk. Defaults to 50.\n* `since` - the `seq` from which to start reading changes.\n\nThe options you are allowed to pass through are: `batch_size`, `batches_limit`, `filter`, `doc_ids`, `query_params`, `since`, and `view`.\n\n### db.load(stream)\n\nLoad changes from the given `stream` into the `db`. Returns a Promise.\n\nThis is an idempotent operation, so you can call it multiple times and it won't change the result.\n\n#### Warning when using `pouchdb-load`\n\nThe [pouchdb-load](https://github.com/nolanlawson/pouchdb-load) plugin has its own `db.load()`\nfunction, which is incompatible with this one. If you want to use both plugins at the same\ntime, then you will need to do:\n\n```js\nvar PouchDB = require('pouchdb');\nvar load = require('pouchdb-load');\nPouchDB.plugin({\n  loadIt: load.load\n});\n// Then load `pouchdb-replication-stream` normally\n```\n\nThen you can use `pouchdb-load` via `db.loadIt()`, which will not clobber the `db.load()` from  this plugin. (You must use Browserify/Webpack, since there is no prebuilt `loadIt()` version.)\n\nDesign\n----\n\nThe replication stream looks like this:\n\n```js\n{\"version\":\"0.1.0\",\"db_type\":\"leveldb\",\"start_time\":\"2014-09-07T21:31:01.527Z\",\"db_info\":{\"doc_count\":3,\"update_seq\":3,\"db_name\":\"testdb\"}}\n{\"docs\":[{\"_id\":\"doc1\",\"_rev\":\"1-x\",\"_revisions\":{\"start\":1,\"ids\":[\"x\"]},\"foo\":\"bar\"}]}\n{\"docs\":[{\"_id\":\"doc2\",\"_rev\":\"1-y\",\"_revisions\":{\"start\":1,\"ids\":[\"y\"]},\"foo\":\"baz\"}]}\n{\"docs\":[{\"_id\":\"doc3\",\"_rev\":\"1-z\",\"_revisions\":{\"start\":1,\"ids\":[\"z\"]},\"foo\":\"quux\"}]}\n{\"seq\":3}\n```\n\nI.e. it's just NDJ - Newline Delimited JSON. Each line is a list of the documents to be loaded into the target database (using `bulkDocs()` with `{new_edits: false}`).\n\nThe first line is a header containing some basic info, like the number of documents in the database and the replication stream protocol version. Such info many be useful for showing a progress bar during the `load()` process, or for handling later versions, in case this protocol changes.\n\nThis replication stream is _idempotent_, meaning you can load it into a target database any number of times, and it will be as if you had only done it once.\n\nAt the end of the `load()` process, the target database will function exactly as if it had been replicated from the source database. Revision hashes, conflicts, attachments, and document contents are all faithfully transported.\n\nSome lines may contain `seq`s; these are used as checkpoints. The `seq` line says, \"When you have loaded all the preceding documents, you are now at update_seq `seq`.\"\n\nFor the time being, attachments are just included as base64-encoded strings, ala CouchDB's `_all_docs` with `attachments=true` and `Accept: application/json`.\n\nInstallation\n--------\n\nTo use this plugin, download it from the `dist` folder and include it after `pouchdb.js` in your HTML page:\n\n```html\n<script src=\"pouchdb.js\"></script>\n<script src=\"pouchdb.replication-stream.js\"></script>\n```\n\nYou can also use Bower:\n\n    bower install pouchdb-replication-stream\n\nOr to use it in Node.js, just npm install it:\n\n    npm install pouchdb-replication-stream\n\nIn Node.js, you can attach it to the `PouchDB` object using the following code:\n\n```js\nvar PouchDB = require('pouchdb');\nvar replicationStream = require('pouchdb-replication-stream');\n\nPouchDB.plugin(replicationStream.plugin);\nPouchDB.adapter('writableStream', replicationStream.adapters.writableStream);\n```\n\nStream directly without the dump file\n---\n\nOn Node.js or with [`Browserify`](http://browserify.org/), ou can use a [`MemoryStream`](https://github.com/JSBizon/node-memorystream) to stream directly without dumping to a file. Here's an example:\n\n```js\nvar Promise = require('bluebird');\nvar PouchDB = require('pouchdb');\nvar replicationStream = require('pouchdb-replication-stream');\nvar MemoryStream = require('memorystream');\n\nPouchDB.plugin(replicationStream.plugin);\nPouchDB.adapter('writableStream', replicationStream.adapters.writableStream);\nvar stream = new MemoryStream();\n\nvar source = new PouchDB('http://localhost:5984/source_db');\nvar dest = new PouchDB('local_destination');\n\nPromise.all([\n  source.dump(stream),\n  dest.load(stream)\n]).then(function () {\n  console.log('Hooray the stream replication is complete!');\n}).catch(function (err) {\n  console.log('oh no an error', err);\n});\n```\n\nThis will also work in the browser if you are using [Browserify](http://browserify.org).\n\nIf you aren't using Browserify, then you can download `MemoryStream` from [https://wzrd.in/standalone/memorystream@latest](https://wzrd.in/standalone/memorystream@latest) and it will be available as `window.memorystream`.\n\nExample:\n\n```html\n<script src=\"lib/pouchdb/dist/pouchdb.js\"></script>\n<script src=\"lib/pouchdb-replication-stream/dist/pouchdb.replication-stream.js\"></script>\n<script src=\"lib/memorystream/memorystream.js\"></script>\n```\n\n```js\nvar localDB = new PouchDB('foo');\nvar remoteDB = new PouchDB('bar');\n\nvar source = new PouchDB('http://localhost:5984/source_db');\nvar dest = new PouchDB('local_destination');\n\nPromise.all([\n  source.dump(stream),\n  dest.load(stream)\n]).then(function () {\n  console.log('Hooray the stream replication is complete!');\n}).catch(function (err) {\n  console.log('oh no an error', err);\n});\n```\n\nDumping to a string\n---\n\nYou can use [`MemoryStream`](https://github.com/JSBizon/node-memorystream) to read in the entire\nstream and dump it to a string.\n\n\n\nExample:\n\n```js\nvar PouchDB = require('pouchdb');\nvar replicationStream = require('pouchdb-replication-stream');\nvar MemoryStream = require('memorystream');\n\nPouchDB.plugin(replicationStream.plugin);\nPouchDB.adapter('writableStream', replicationStream.adapters.writableStream);\n\nvar dumpedString = '';\nvar stream = new MemoryStream();\nstream.on('data', function(chunk) {\n  dumpedString += chunk.toString();\n});\n\nvar db = new PouchDB('my_db');\n\ndb.dump(stream).then(function () {\n  console.log('Yay, I have a dumpedString: ' + dumpedString);\n}).catch(function (err) {\n  console.log('oh no an error', err);\n});\n```\n\nThis will also work in the browser via [Browserify](http://browserify.org/).\n\nIf you aren't using Browserify, then you can download `MemoryStream` from [https://wzrd.in/standalone/memorystream@latest](https://wzrd.in/standalone/memorystream@latest) and it will be available as `window.memorystream`.\n\nExample:\n\n```html\n<script src=\"lib/pouchdb/dist/pouchdb.js\"></script>\n<script src=\"lib/pouchdb-replication-stream/dist/pouchdb.replication-stream.js\"></script>\n<script src=\"lib/memorystream/memorystream.js\"></script>\n```\n\n```js\nvar db = new PouchDB('my_db');\n\nvar MemoryStream = window.MemoryStream;\n\nvar dumpedString = '';\nstream.on('data', function(chunk) {\n  dumpedString += chunk.toString();\n});\n\ndb.dump(stream).then(function () {\n  console.log('Yay, I have a dumpedString: ' + dumpedString);\n}).catch(function (err) {\n  console.log('oh no an error', err);\n});\n```\n\nKnown pitfalls\n---\n\n### Read error 400 ECONNRESET\n\nBasically this means your CouchDB cannot handle all concurrent requests happening. Most probable cause is you have 200+ attachments on one of your documents.\n\nOne simple way to get around this error is to limit the globalAgent maxSockets, which manages the maximum number of concurret http requests.\n\n```js\nrequire('http').globalAgent.maxSockets = 25;\n```\n\n### Trying to speed up PouchDB replication?\n\nIf you are using this library in the browser, then it's not going to speed up replication. The whole point is to minify the number of HTTP requests by collapsing replication into a stream, and then sending one big chunk down the wire to the client. If you use it on the client side, then it will still make many small requests to the server, which is slow.\n\nWhat you probably want is to use this library server-side, in a Node.js process. For a good example, see the Express wrapper: [express-pouchdb-replication-stream](https://github.com/conor-mac-aoidh/express-pouchdb-replication-stream).\n\nBuilding\n----\n    npm install\n    npm run build\n\nYour plugin is now located at `dist/pouchdb.mypluginname.js` and `dist/pouchdb.mypluginname.min.js` and is ready for distribution.\n\nTesting\n----\n\n### In Node\n\nThis will run the tests in Node using LevelDB:\n\n    npm test\n\nYou can also check for 100% code coverage using:\n\n    npm run coverage\n\nIf you don't like the coverage results, change the values from 100 to something else in `package.json`, or add `/*istanbul ignore */` comments.\n\n\nIf you have mocha installed globally you can run single test with:\n```\nTEST_DB=local mocha --reporter spec --grep search_phrase\n```\n\nThe `TEST_DB` environment variable specifies the database that PouchDB should use (see `package.json`).\n\n### In the browser\n\nRun `npm run dev` and then point your favorite browser to [http://127.0.0.1:8001/test/index.html](http://127.0.0.1:8001/test/index.html).\n\nThe query param `?grep=mysearch` will search for tests matching `mysearch`.\n\n### Automated browser tests\n\nYou can run e.g.\n\n    CLIENT=selenium:firefox npm test\n    CLIENT=selenium:phantomjs npm test\n\nThis will run the tests automatically and the process will exit with a 0 or a 1 when it's done. Firefox uses IndexedDB, and PhantomJS uses WebSQL.\n","readmeFilename":"README.md"}