{"_id":"@9wick/node-web-serial-ponyfill","_rev":"5-ad75eaccea4d78af3656254b1c3380f0","name":"@9wick/node-web-serial-ponyfill","dist-tags":{"latest":"0.5.3-beta.4"},"versions":{"0.5.3":{"name":"@9wick/node-web-serial-ponyfill","version":"0.5.3","keywords":[],"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","_id":"@9wick/node-web-serial-ponyfill@0.5.3","maintainers":[{"name":"kido","email":"kido@9wick.com"}],"homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"dist":{"shasum":"2a5503bd05afff58e7fdda8bc6c47021bad4107c","tarball":"https://registry.npmjs.org/@9wick/node-web-serial-ponyfill/-/node-web-serial-ponyfill-0.5.3.tgz","fileCount":3,"integrity":"sha512-oIoLsd8vveQz+ewhf8wUxASaP8htnNDOhjdfB72k0WULPT5s1QisUocyfeO7wyHre2JH3tTgaerpUG3vJwjkhw==","signatures":[{"sig":"MEYCIQD9X4PGne94DEZaRXB6I4m4/mEUq+w82GffjsPK7Ue+3QIhANR3xvomwbTX8iYD51Sycwvman+iUUi8U4qnevTmA425","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6146},"main":"dist/node-web-serial-ponyfill.cjs.js","module":"dist/node-web-serial-ponyfill.es.js","engines":{"node":">=16.0.0"},"gitHead":"b239d766aba86e438a2d64a45cc576c0b8240936","scripts":{"dev":"rollup -c -w","test":"jest","build":"tsc && NODE_ENV=production rollup -c","start":"ts-node examples/connect.ts","pretest":"npm run build"},"typings":"index.d.ts","_npmUser":{"name":"kido","email":"kido@9wick.com"},"repository":{"url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git","type":"git"},"_npmVersion":"10.7.0","description":"An implementation of the Serial API on top of the Node.js serialport package.","directories":{},"_nodeVersion":"20.14.0","dependencies":{"serialport":"^10.4.0","@types/dom-serial":"^1.0.2","web-streams-polyfill":"^3.2.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","tslib":"^2.4.0","rollup":"^2.75.6","ts-jest":"^28.0.4","ts-node":"^10.8.1","babel-jest":"^28.1.1","typescript":"^4.7.3","@babel/core":"^7.18.2","@types/jest":"^28.1.1","@babel/preset-env":"^7.18.2","rollup-plugin-dts":"^4.2.2","@rollup/plugin-json":"^4.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-license":"^2.8.0","@rollup/plugin-commonjs":"^22.0.0","@babel/preset-typescript":"^7.17.12","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-exclude-dependencies-from-bundle":"^1.1.22"},"_npmOperationalInternal":{"tmp":"tmp/node-web-serial-ponyfill_0.5.3_1720751857281_0.27328116264313174","host":"s3://npm-registry-packages"}},"0.5.3-beta.0":{"name":"@9wick/node-web-serial-ponyfill","version":"0.5.3-beta.0","keywords":[],"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","_id":"@9wick/node-web-serial-ponyfill@0.5.3-beta.0","maintainers":[{"name":"kido","email":"kido@9wick.com"}],"homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"dist":{"shasum":"bcfaa46500925900af4489f03e39ec785b585dd7","tarball":"https://registry.npmjs.org/@9wick/node-web-serial-ponyfill/-/node-web-serial-ponyfill-0.5.3-beta.0.tgz","fileCount":3,"integrity":"sha512-ommDm88ao9DOceI9UHKjCKfL/sH1IxMvaKbaWHQs0eOxJr07SqZVYPVGTwem3/acUugnK8NF9QnFkAjIA5MNGQ==","signatures":[{"sig":"MEYCIQCp2moMu9GMteyrw1Ewb9hrGj0eX4sN9SNXQiDdTAmzXAIhANuRQIO6Vr7iOtWYQElEUXTSeUJffGvRIaYvTZvpPmj9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6153},"main":"dist/node-web-serial-ponyfill.cjs.js","module":"dist/node-web-serial-ponyfill.es.js","engines":{"node":">=16.0.0"},"gitHead":"2622010030a87b0455c967a5b8ae581cbfbe6d1c","scripts":{"dev":"rollup -c -w","test":"jest","build":"tsc && NODE_ENV=production rollup -c","start":"ts-node examples/connect.ts","pretest":"npm run build"},"typings":"index.d.ts","_npmUser":{"name":"kido","email":"kido@9wick.com"},"repository":{"url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git","type":"git"},"_npmVersion":"10.7.0","description":"An implementation of the Serial API on top of the Node.js serialport package.","directories":{},"_nodeVersion":"20.14.0","dependencies":{"serialport":"^10.4.0","@types/dom-serial":"^1.0.2","web-streams-polyfill":"^3.2.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","tslib":"^2.4.0","rollup":"^2.75.6","ts-jest":"^28.0.4","ts-node":"^10.8.1","babel-jest":"^28.1.1","typescript":"^4.7.3","@babel/core":"^7.18.2","@types/jest":"^28.1.1","@babel/preset-env":"^7.18.2","rollup-plugin-dts":"^4.2.2","@rollup/plugin-json":"^4.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-license":"^2.8.0","@rollup/plugin-commonjs":"^22.0.0","@babel/preset-typescript":"^7.17.12","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-exclude-dependencies-from-bundle":"^1.1.22"},"_npmOperationalInternal":{"tmp":"tmp/node-web-serial-ponyfill_0.5.3-beta.0_1720752191997_0.7126332944886697","host":"s3://npm-registry-packages"}},"0.5.3-beta.1":{"name":"@9wick/node-web-serial-ponyfill","version":"0.5.3-beta.1","keywords":[],"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","_id":"@9wick/node-web-serial-ponyfill@0.5.3-beta.1","maintainers":[{"name":"kido","email":"kido@9wick.com"}],"homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"dist":{"shasum":"29a96c84ce5d24aa6814b6a6ef492dfaaed89762","tarball":"https://registry.npmjs.org/@9wick/node-web-serial-ponyfill/-/node-web-serial-ponyfill-0.5.3-beta.1.tgz","fileCount":8,"integrity":"sha512-VIM7zn56+70EteiFr0v/G+Mwp4bYL8+jFS2iNfWeMwdU/smLo7Eop5JT+iDB1I9DIiR9rdNqH8fpJfwRPAgYhg==","signatures":[{"sig":"MEQCIE10W5KsBn/kMe5k4qZuj5l8xYodkUaG1qmbyIEIWAoxAiA9AiLwfHTfbWvOGZOKMxuaePLCKOZagdFxXdzvs1MWfQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":142236},"main":"dist/node-web-serial-ponyfill.cjs.js","module":"dist/node-web-serial-ponyfill.es.js","engines":{"node":">=16.0.0"},"gitHead":"2a269185c6c36403c97a5a870c9c41acc4b90b17","scripts":{"dev":"rollup -c -w","test":"jest","build":"tsc && NODE_ENV=production rollup -c","start":"ts-node examples/connect.ts","pretest":"npm run build"},"typings":"index.d.ts","_npmUser":{"name":"kido","email":"kido@9wick.com"},"repository":{"url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git","type":"git"},"_npmVersion":"10.7.0","description":"An implementation of the Serial API on top of the Node.js serialport package.","directories":{},"_nodeVersion":"20.14.0","dependencies":{"serialport":"^10.4.0","@types/dom-serial":"^1.0.2","web-streams-polyfill":"^3.2.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","tslib":"^2.4.0","rollup":"^2.75.6","ts-jest":"^28.0.4","ts-node":"^10.8.1","babel-jest":"^28.1.1","typescript":"^4.7.3","@babel/core":"^7.18.2","@types/jest":"^28.1.1","@babel/preset-env":"^7.18.2","rollup-plugin-dts":"^4.2.2","@rollup/plugin-json":"^4.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-license":"^2.8.0","@rollup/plugin-commonjs":"^22.0.0","@babel/preset-typescript":"^7.17.12","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-exclude-dependencies-from-bundle":"^1.1.22"},"_npmOperationalInternal":{"tmp":"tmp/node-web-serial-ponyfill_0.5.3-beta.1_1720752228171_0.85281814019292","host":"s3://npm-registry-packages"}},"0.5.3-beta.2":{"name":"@9wick/node-web-serial-ponyfill","version":"0.5.3-beta.2","keywords":[],"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","_id":"@9wick/node-web-serial-ponyfill@0.5.3-beta.2","maintainers":[{"name":"kido","email":"kido@9wick.com"}],"homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"dist":{"shasum":"7f0047ad80f37835b1778d724fae78b62ae3c4ba","tarball":"https://registry.npmjs.org/@9wick/node-web-serial-ponyfill/-/node-web-serial-ponyfill-0.5.3-beta.2.tgz","fileCount":8,"integrity":"sha512-m8GlftBzVPXwjXM/hAwOr0GgBgAmSi8axSl5xpu1Dg4j9eDixNWQbT96ox5Mt+DmmPcpTAG4EycuS4WM+OSEjg==","signatures":[{"sig":"MEUCIQD4EkNzaVzZw4thqH/T7lxTeLLfI8yzthxVP1xLAXxqkAIgS4OtQkPGPPk87vpeyY6y2YP7NbOkfRoe8Q5WunfvjCM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":142236},"main":"dist/node-web-serial-ponyfill.cjs.js","module":"dist/node-web-serial-ponyfill.es.js","engines":{"node":">=16.0.0"},"gitHead":"48e48bc917c0d3c7245dd82f8bfa763c04af49f8","scripts":{"dev":"rollup -c -w","test":"jest","build":"tsc && NODE_ENV=production rollup -c","start":"ts-node examples/connect.ts","pretest":"npm run build"},"typings":"index.d.ts","_npmUser":{"name":"kido","email":"kido@9wick.com"},"repository":{"url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git","type":"git"},"_npmVersion":"10.7.0","description":"An implementation of the Serial API on top of the Node.js serialport package.","directories":{},"_nodeVersion":"20.14.0","dependencies":{"serialport":"^10.4.0","@types/dom-serial":"^1.0.2","web-streams-polyfill":"^3.2.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","tslib":"^2.4.0","rollup":"^2.75.6","ts-jest":"^28.0.4","ts-node":"^10.8.1","babel-jest":"^28.1.1","typescript":"^4.7.3","@babel/core":"^7.18.2","@types/jest":"^28.1.1","@babel/preset-env":"^7.18.2","rollup-plugin-dts":"^4.2.2","@rollup/plugin-json":"^4.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-license":"^2.8.0","@rollup/plugin-commonjs":"^22.0.0","@babel/preset-typescript":"^7.17.12","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-exclude-dependencies-from-bundle":"^1.1.22"},"_npmOperationalInternal":{"tmp":"tmp/node-web-serial-ponyfill_0.5.3-beta.2_1721294802202_0.4964924033596301","host":"s3://npm-registry-packages"}},"0.5.3-beta.3":{"name":"@9wick/node-web-serial-ponyfill","version":"0.5.3-beta.3","keywords":[],"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","_id":"@9wick/node-web-serial-ponyfill@0.5.3-beta.3","maintainers":[{"name":"kido","email":"kido@9wick.com"}],"homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"dist":{"shasum":"302c195be622042683618fdbfc1d226b27267608","tarball":"https://registry.npmjs.org/@9wick/node-web-serial-ponyfill/-/node-web-serial-ponyfill-0.5.3-beta.3.tgz","fileCount":8,"integrity":"sha512-O+FIRgOga04L+x7+fP8LYVtaUItwlP6dlLm5bU5xwXzBlpmsLVUNnO6mLudmLqxt5/Ep7SsUzKTRAAMD8bEJdw==","signatures":[{"sig":"MEQCIB6IGCI/qw0GVSlXOB6u6EiXfB7Xq6Shgb94kUKbJkQ5AiAP02vybEbFJTA0QpcNL2zV5WLICP7+89SxSSkunjjdGw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":142758},"main":"dist/node-web-serial-ponyfill.cjs.js","module":"dist/node-web-serial-ponyfill.es.js","engines":{"node":">=16.0.0"},"gitHead":"67db9bf383203043379e47044d48497fcd00e02f","scripts":{"dev":"rollup -c -w","test":"jest","build":"tsc && NODE_ENV=production rollup -c","start":"ts-node examples/connect.ts","pretest":"npm run build"},"typings":"index.d.ts","_npmUser":{"name":"kido","email":"kido@9wick.com"},"repository":{"url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git","type":"git"},"_npmVersion":"10.7.0","description":"An implementation of the Serial API on top of the Node.js serialport package.","directories":{},"_nodeVersion":"20.14.0","dependencies":{"serialport":"^10.4.0","@types/dom-serial":"^1.0.2","web-streams-polyfill":"^3.2.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.1","tslib":"^2.4.0","rollup":"^2.75.6","ts-jest":"^28.0.4","ts-node":"^10.8.1","babel-jest":"^28.1.1","typescript":"^4.7.3","@babel/core":"^7.18.2","@types/jest":"^28.1.1","@babel/preset-env":"^7.18.2","rollup-plugin-dts":"^4.2.2","@rollup/plugin-json":"^4.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-license":"^2.8.0","@rollup/plugin-commonjs":"^22.0.0","@babel/preset-typescript":"^7.17.12","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-exclude-dependencies-from-bundle":"^1.1.22"},"_npmOperationalInternal":{"tmp":"tmp/node-web-serial-ponyfill_0.5.3-beta.3_1721295315034_0.47102064945289523","host":"s3://npm-registry-packages"}},"0.5.3-beta.4":{"name":"@9wick/node-web-serial-ponyfill","version":"0.5.3-beta.4","description":"An implementation of the Serial API on top of the Node.js serialport package.","main":"dist/node-web-serial-ponyfill.cjs.js","typings":"index.d.ts","module":"dist/node-web-serial-ponyfill.es.js","engines":{"node":">=16.0.0"},"scripts":{"start":"ts-node examples/connect.ts","build":"tsc && NODE_ENV=production rollup -c","dev":"rollup -c -w","test":"jest","pretest":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git"},"keywords":[],"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","devDependencies":{"@babel/core":"^7.18.2","@babel/preset-env":"^7.18.2","@babel/preset-typescript":"^7.17.12","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-typescript":"^8.3.2","@types/jest":"^28.1.1","babel-jest":"^28.1.1","jest":"^28.1.1","rollup":"^2.75.6","rollup-plugin-dts":"^4.2.2","rollup-plugin-exclude-dependencies-from-bundle":"^1.1.22","rollup-plugin-license":"^2.8.0","rollup-plugin-terser":"^7.0.2","ts-jest":"^28.0.4","ts-node":"^10.8.1","tslib":"^2.4.0","typescript":"^4.7.3"},"dependencies":{"@types/dom-serial":"^1.0.2","serialport":"^12.0.0","web-streams-polyfill":"^3.2.1"},"_id":"@9wick/node-web-serial-ponyfill@0.5.3-beta.4","gitHead":"c0917a7481fcea3ac5115f90d965439f6eb814ed","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-LISm0M3/601MSQVSh+2wur+KNl6X6Jye9x9fCmjFsZUOdRsPnEMnrDvTaYDLilcRb840hBGkkgRnlWXVcjt9cA==","shasum":"646a866f84666c432feb0dcd592f2cde66695cb2","tarball":"https://registry.npmjs.org/@9wick/node-web-serial-ponyfill/-/node-web-serial-ponyfill-0.5.3-beta.4.tgz","fileCount":8,"unpackedSize":142758,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEd6viV8TeixJ1yEDmf4yj0Dur8kgLgdodoDJ4j3mlclAiEA9TCbfDBSSVVTCzmiYbRPhww8x1xoeimDtLHnsy/W9tw="}]},"_npmUser":{"name":"kido","email":"kido@9wick.com"},"directories":{},"maintainers":[{"name":"kido","email":"kido@9wick.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-web-serial-ponyfill_0.5.3-beta.4_1721713011691_0.9556246485645441"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-12T02:37:37.154Z","modified":"2024-07-23T05:36:52.020Z","0.5.3":"2024-07-12T02:37:37.411Z","0.5.3-beta.0":"2024-07-12T02:43:12.133Z","0.5.3-beta.1":"2024-07-12T02:43:48.579Z","0.5.3-beta.2":"2024-07-18T09:26:42.408Z","0.5.3-beta.3":"2024-07-18T09:35:15.192Z","0.5.3-beta.4":"2024-07-23T05:36:51.840Z"},"bugs":{"url":"https://github.com/jerrylum/node-web-serial-ponyfill/issues"},"author":{"name":"jerrylum","email":"me@jerryio.com"},"license":"MIT","homepage":"https://github.com/jerrylum/node-web-serial-ponyfill#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/jerrylum/node-web-serial-ponyfill.git"},"description":"An implementation of the Serial API on top of the Node.js serialport package.","maintainers":[{"name":"kido","email":"kido@9wick.com"}],"readme":"[![codecov](https://codecov.io/gh/Jerrylum/node-web-serial-ponyfill/branch/main/graph/badge.svg?token=1Z6QV5TOIY)](https://codecov.io/gh/Jerrylum/node-web-serial-ponyfill) ![GitHub](https://img.shields.io/github/license/Jerrylum/node-web-serial-ponyfill) ![npm](https://img.shields.io/npm/v/node-web-serial-ponyfill) ![node-current (tag)](https://img.shields.io/node/v/node-web-serial-ponyfill/latest)\n\nAn implementation of the Serial API on top of the Node.js serialport package.\n\n<br/>\n\n# What is this?\n\nFor example, you wrote a program that connect to a device through Web Serial API.\n\n```js\n(async function () {\n    let filters = [{ usbVendorId: 10376 }];\n\n    let port = await navigator.serial.requestPort({ filters });\n\n    await port.open({ baudRate: 115200 });\n\n    let reader = port.readable.getReader();\n    let writer = port.writable.getWriter();\n\n    await writer.write(Uint8Array.from([201, 54, 184, 71, 86, 34, 0, 96, 252]));\n\n    ...\n\n    await reader.cancel();\n    await writer.close();\n    await port.close();\n})();\n```\n\nIt works on the browser. Now, you want to do the same things in the Node.js environment. However, Web Serial API is not supported in Node.js. You need to install a package called `serialport` and you won't be able to reuse the code since the API is different.\n\n<br/>\n\nWith this library, you can write a program that works on both browser and Node.js environment. All you need to do is import this package and change a few lines of code:\n\n```diff\n+ import { serial } from \"node-web-serial-ponyfill\";\n\n(async function () {\n    let filters = [{ usbVendorId: 10376 }];\n\n-   let port = await navigator.serial.requestPort({ filters });\n+   let port = await serial.requestPort({ filters });\n\n    await port.open({ baudRate: 115200 });\n\n    ...\n})();\n```\n\nBy doing this, you can now connect to a device in a Node.js program without changing the code.\n\n\n# But wait, what about the user interface?\n\nGood question! The user interface is the same as the browser. If you ask the user to select a serial port, they will be able to select one from the console.\n\n![Ask user to select a port in the console](readme/request-port-ui-compare.png)\n\n\n# More features:\n\nIn addition, you can still do everything you can do in Node.js. For example, you can connect to a serial port by providing the path name. So we provide you the `findPort` method which will return the port that matches the given path name. It's specific to Node.js and you can't do it in the browser. Here is the type definition of this package.\n\n```ts\ninterface NodeSerial extends Serial {\n    /**\n     * Returns all serial ports connected to the host filtered by the options.\n     */\n    listPorts(options?: SerialPortRequestOptions): Promise<SerialPort[]>;\n    \n    /**\n     * Returns a SerialPort on the path.\n     */\n    findPort(portPath: string): Promise<SerialPort | undefined>;\n    \n    ...\n}\n\n...\n\ndeclare const serial: NodeSerial;\n```\n\n\n# Differences:\n\n- Events `connect` and `disconnect` are not implemented.\n- Events `open` and `close` are implemented in the serial port class.\n- A serial port can be closed without releasing the readable and writable streams.\n\n\n# Development\n\nRemember to install the following package:\n\n```sh\nnpm install -g win-node-env\n```\n\nGood Luck!","readmeFilename":"README.md"}