{"_id":"@6river/rosbag","_rev":"7-3afe95a13b1b4581a04cac4938eba83a","name":"@6river/rosbag","dist-tags":{"latest":"1.1.0-browserOrNode.2"},"versions":{"1.0.2-6river":{"name":"@6river/rosbag","version":"1.0.2-6river","license":"Apache-2.0","dependencies":{"bluebird":"3.5.0","browser-or-node":"1.0.2","buffer":"5.0.5","heap":"0.2.6","int53":"0.2.4","yarn":"1.6.0"},"engines":{"node":">=8.0.0"},"main":"es5","module":"lib","scripts":{"prepack":"npm run build","lint":"eslint lib test","lint-prettier":"prettier -l '{lib,test}/**/*.js'","mocha":"mocha test/*.js","unit":"npm run mocha","test":"npm run unit && npm run lint && npm run lint-prettier","build":"mkdir -p es5/ && babel --out-dir es5 lib"},"devDependencies":{"babel-cli":"6.24.0","babel-core":"6.24.0","babel-eslint":"7.2.1","babel-plugin-syntax-async-functions":"6.13.0","babel-plugin-transform-es2015-modules-commonjs":"6.24.0","babel-register":"6.24.0","chai":"4.0.2","compressjs":"1.0.3","eslint":"3.19.0","eslint-config-airbnb":"15.0.1","eslint-plugin-import":"2.2.0","eslint-plugin-jsx-a11y":"5.0.1","eslint-plugin-react":"7.1.0","lz4js":"0.2.0","mocha":"3.2.0","prettier":"1.10.2"},"prettier":{"arrowParens":"always","jsxBracketSameLine":true,"printWidth":120,"trailingComma":"es5"},"gitHead":"6ad97cfd4e77efb04d01b8665582a65231b48ea4","description":"`rosbag` is a node.js & browser compatible module for reading [rosbag](http://wiki.ros.org/rosbag) binary data files.","_id":"@6river/rosbag@1.0.2-6river","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"jjhughes57","email":"jjhughes57@gmail.com"},"dist":{"integrity":"sha512-sntLaGzsyIH3KKjyumN+JtrCxxgXicCNS5Fxa3qZz10dwnYwD0ptehkM+kdq8pSoLZEZb68tg3s9mJ7apsHT3Q==","shasum":"f2a1145da4a3af6562b08ff7db5b74c3a76b11b9","tarball":"https://registry.npmjs.org/@6river/rosbag/-/rosbag-1.0.2-6river.tgz","fileCount":38,"unpackedSize":181367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8KhjCRA9TVsSAnZWagAAQf8P/2D41VWg4WYQKcnWmtBx\nop0Z+K7mXaQFzEkWsZJsosQKpXSUiCNV60COi94b9TxNSkWA15T9X9Vc3Hb9\nxjAGXYPVO8AZI9jkWsfAyofEWQQpnNX3x1Yq70kfGfA3O3oEBvp/UwWFMP3d\nidoYe0xs0aiXRL0iNvdHQL4sHfEbrOXKutNtUGEa0d/CG2k6/aeAB77DNzxB\n9nJuXYpZ0xTg3PMaJFbH3uy1cUz1OdovyyCp5v8m+JYYrLZoxFrFARuSYEFd\nB8U8qt9NSvnqLyM45tJbQ+9E6YMcz/GavhEP/Q/YyZyiuRTuNyzQAmiKWMbm\nzBDqzGnLPpWSYcIEnqGTX85kCcFJpVsODxHJL3XzRH+XpJbckmhRlKHmM7ma\nBZIicRvXzUXdh+nWrQhdAcGZ507K+mfnCgLYEgS8xI2pm8ZxDbWSFf7ircyw\naNOpMh2dIUg0Xpa/m6/RROsMmBGQQU6fpXDwcthIw0kGc4/Y5wDSXqRt4iLT\nxKj/M0g2OMV0ZK/VBBVAmlKtuad4OUzQCPgG5mG4adhxPhH27QCYjMyW12ZZ\nvvxzLjxU4gzVm9k9uJf47xWQ8x0mMic7zPp9jKBwRPVU5JX3lZy/1p5axnux\n1cD9s+YrJlMjiuGyydaHzVrkt9mYVZNSSDa7VvMJPsLBYdPkX0RwMJv5wl/g\neu9Q\r\n=dQAR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG46fm1CTN4YyC9WlyNnNgSLP+nY2q4SyygbwMg3XCHYAiEAyEOkWcoet05avJwmZ8HsqrXiItt61r9sGNm0/pBcBSY="}]},"maintainers":[{"name":"6river-machine","email":"swdev@6river.com"},{"name":"c11k","email":"josh@c11k.org"},{"name":"jbcpollak","email":"josh@offthehill.org"},{"name":"jjhughes57","email":"jjhughes57@gmail.com"},{"name":"kolach","email":"chikolad@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rosbag_1.0.2-6river_1525721186072_0.014162841958998307"},"_hasShrinkwrap":false},"1.1.0-browserOrNode.1":{"dependencies":{"bluebird":"3.5.0","browser-or-node":"1.0.2","buffer":"5.0.5","heap":"0.2.6","int53":"0.2.4","yarn":"1.6.0"},"devDependencies":{"babel-cli":"6.24.0","babel-core":"6.24.0","babel-eslint":"7.2.1","babel-plugin-syntax-async-functions":"6.13.0","babel-plugin-transform-es2015-modules-commonjs":"6.24.0","babel-register":"6.24.0","chai":"4.0.2","compressjs":"1.0.3","eslint":"3.19.0","eslint-config-airbnb":"15.0.1","eslint-plugin-import":"2.2.0","eslint-plugin-jsx-a11y":"5.0.1","eslint-plugin-react":"7.1.0","lz4js":"0.2.0","mocha":"3.2.0","prettier":"1.10.2"},"engines":{"node":">=8.0.0"},"license":"Apache-2.0","main":"es5","module":"lib","name":"@6river/rosbag","prettier":{"arrowParens":"always","jsxBracketSameLine":true,"printWidth":120,"trailingComma":"es5"},"scripts":{"prepack":"npm run build","lint":"eslint lib test","lint-prettier":"prettier -l '{lib,test}/**/*.js'","mocha":"mocha test/*.js","unit":"npm run mocha","test":"npm run unit && npm run lint && npm run lint-prettier","build":"mkdir -p es5/ && babel --out-dir es5 lib"},"version":"1.1.0-browserOrNode.1","gitHead":"10265e318510c34082486ec6f9c02017aee5a92f","description":"`rosbag` is a node.js & browser compatible module for reading [rosbag](http://wiki.ros.org/rosbag) binary data files.","_id":"@6river/rosbag@1.1.0-browserOrNode.1","_npmVersion":"5.4.2","_nodeVersion":"8.8.1","_npmUser":{"name":"jjhughes57","email":"jjhughes57@gmail.com"},"dist":{"integrity":"sha512-Lpb74eDJfprlWNoIxqQ/4DemzvgQMSGbtdRtpRrQ4kwanJoXvTBWZvdsVTE3UA4dyTC/lt/1ruzI20z5Q+fPOg==","shasum":"1a261051eb0f553807b5848f273414f660f6f191","tarball":"https://registry.npmjs.org/@6river/rosbag/-/rosbag-1.1.0-browserOrNode.1.tgz","fileCount":41,"unpackedSize":189026,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8Kt7CRA9TVsSAnZWagAAMtgQAIjqJQJB1U7gZyS5GJ/w\ns5hN731gt/R8kosXeKD/1g+/LzkLCOGJ12EHCEvN/diKyrqOkdNGX6Twl7aB\nlQjTcuEEitbEB2TZsMMhKSd4TEBWvhIuczCvGBP+OmJZBF0wO5zhDRG/s9TS\nY65xahoZnnl75geTH2xqKughraJNKx0Z2RRPm6KNVKtLxp/A5P1058nwWr2Y\nMXWoviGfjltXasQosF/H43hqhaCpkJaitTzcinkNqAPMGqKpFhAgmZsHZVeK\nrxvYEWa45h8b5gaa5II5lOi5UxR73zTiMIfATn/9eRGKEFtfGRapL7FxtZR7\ndZ4k0gB1HqDmfasDmCqPGYprIsesGEM3aLaOtqszahKlAgeYKl90Tafs+jw4\nPY40VFYcaNidQCjMaA1I3y8sdCEE0TpgR0rvaO2M7pxP2UsjLw3qYYlY0kDD\ndcf6iWO2CW9Nykz6KJNHDPHFZZfX1XMS0yBkvdOvES5buJJhiTiEgSNJ2UGw\nEK66uRdsAd2QKshDIqq2MJwfk9uKGHqPr54joY9lPWLP5tPYLznh+w5ot8g8\nXtHl70YhahdmPTf3tXTkdd9tpWmjjTsUPqY+EzcyZ9bNwHKE8Xev4Xx9tl9S\nOE7pHAWcRUHay2KTXv2Y0QY21yqpjy/oCBEiW4WLOltJgbKd6xUz0X7xA3n0\ncdBi\r\n=cdD7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmW4/Mf4Myr3xRipwCSu+8q4KemFi486q1iu+bkNT2rAIgFgkdJwfiC9819FquagF29CyvP6LDxvYJ/aJyzrDeDQ8="}]},"maintainers":[{"name":"6river-machine","email":"swdev@6river.com"},{"name":"c11k","email":"josh@c11k.org"},{"name":"jbcpollak","email":"josh@offthehill.org"},{"name":"jjhughes57","email":"jjhughes57@gmail.com"},{"name":"kolach","email":"chikolad@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rosbag_1.1.0-browserOrNode.1_1525721978999_0.35108748302079906"},"_hasShrinkwrap":false},"1.1.0-browserOrNode.2":{"dependencies":{"bluebird":"3.5.0","browser-or-node":"1.0.2","buffer":"5.0.5","heap":"0.2.6","int53":"0.2.4","yarn":"1.6.0"},"devDependencies":{"@babel/cli":"7.0.0-beta.46","@babel/core":"7.0.0-beta.46","@babel/preset-env":"7.0.0-beta.46","babel-eslint":"7.2.1","babel-plugin-syntax-async-functions":"6.13.0","babel-plugin-transform-es2015-modules-commonjs":"6.24.0","babel-register":"6.24.0","chai":"4.0.2","compressjs":"1.0.3","eslint":"3.19.0","eslint-config-airbnb":"15.0.1","eslint-plugin-import":"2.2.0","eslint-plugin-jsx-a11y":"5.0.1","eslint-plugin-react":"7.1.0","lz4js":"0.2.0","mocha":"3.2.0","prettier":"1.10.2"},"engines":{"node":">=8.0.0"},"license":"Apache-2.0","main":"es5","module":"es5","name":"@6river/rosbag","prettier":{"arrowParens":"always","jsxBracketSameLine":true,"printWidth":120,"trailingComma":"es5"},"scripts":{"prepack":"npm run build","lint":"eslint lib test","lint-prettier":"prettier -l '{lib,test}/**/*.js'","mocha":"mocha test/*.js","unit":"npm run mocha","test":"npm run unit && npm run lint && npm run lint-prettier","build":"mkdir -p es5/ && babel --out-dir es5 lib"},"version":"1.1.0-browserOrNode.2","gitHead":"8c5b5df39b1cc8661b2b60d9630fd225a976480f","description":"`rosbag` is a node.js & browser compatible module for reading [rosbag](http://wiki.ros.org/rosbag) binary data files.","_id":"@6river/rosbag@1.1.0-browserOrNode.2","_npmVersion":"5.4.2","_nodeVersion":"8.8.1","_npmUser":{"name":"jjhughes57","email":"jjhughes57@gmail.com"},"dist":{"integrity":"sha512-WcNlmr6RP6vyMQg+4kYZPJgGPluSmRwTEIpR2I1a8vbumzZe4Gt7qDS5RTioBHQM/9WmrEaL3Eiw7sA1qjBAZQ==","shasum":"ac8b7beaaa162340392b6b668e3007f98b994989","tarball":"https://registry.npmjs.org/@6river/rosbag/-/rosbag-1.1.0-browserOrNode.2.tgz","fileCount":42,"unpackedSize":217811,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8MYtCRA9TVsSAnZWagAAJasP/03mGpqlWAtRKJzFdizg\nsA2AHwSy2M/o4dgEDFin0OFE5om4GzVETwJnVzt7s4+vpl7VFotxUuaF30Cs\ndweNEuo6I/knZ/pBMxL9X9v26izy/lZcxnsA0++EyCcieTBvC6HvmQFED2ZV\nPnhH32FOjiwEZFAGQnMO9JLdSbBteejY6PvjS32JsJcLsYhYe+Aba9CBT3oH\nsTNrvlVbYhaanmqLj8xWI6l2PVs16XIuheSDj4Z6rJk3+7/VxCScsK8KRhHJ\nqQaMgljzpwauDHJRnlr6CDAvfAttVvTFaf1MhFAUTQQr669j6G6AkP2xjK6J\nXPLhWbGAhSfB2yhLFUNWnuF/zR8r7uZwnqdX/1TEZ+8dB0ydHgVgIEBYVC5z\naj6UnFfWMS//uvqrq43OH60iMSrmTVZIPuBGSdNqPuBaQ/B7S89xPXQRoCUr\nyg0kCxz+xBD6ShAEDTFsPcbyocaeyGem2Yq4kDfzs4pN9wEBCynQXfO3ymT1\nEBHo0Geczn+9jkv0ilET0BX754gVeF595i05qFoTTwyd+gZojXI2OA0pgGuj\nMEPbkHT+bohPVrg2RxxzTGdpHJ0J+O/qfDnJmy5NwHkBDP08Ky9gfvRH5Ek3\nki4Lm5KdvC5hy8tFMItYZxzPhPg35CmpoJJZNQ2/MJ3aTQmHEJn32owI3kTr\nHJwm\r\n=O5bI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHAG7/RsAiNLC1hKQtbxRTUhqTlDjId02fGwUdxoGqQQIhAPJ5hWQQLnDuV1vOa0ZZoarg87dZkJVL6VaXw0cburrX"}]},"maintainers":[{"name":"6river-machine","email":"swdev@6river.com"},{"name":"c11k","email":"josh@c11k.org"},{"name":"jbcpollak","email":"josh@offthehill.org"},{"name":"jjhughes57","email":"jjhughes57@gmail.com"},{"name":"kolach","email":"chikolad@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rosbag_1.1.0-browserOrNode.2_1525728812333_0.9409524076197981"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-07T19:26:26.021Z","1.0.2-6river":"2018-05-07T19:26:26.187Z","modified":"2023-01-05T16:58:32.831Z","1.1.0-browserOrNode.1":"2018-05-07T19:39:39.052Z","1.1.0-browserOrNode.2":"2018-05-07T21:33:32.437Z"},"maintainers":[{"email":"eng_sw_devops@6river.com","name":"6river-npm"},{"email":"swdev@6river.com","name":"6river-machine"},{"email":"chikolad@gmail.com","name":"kolach"},{"email":"jjhughes57@gmail.com","name":"jjhughes57"},{"email":"afrance@6river.com","name":"aaron.france"}],"description":"`rosbag` is a node.js & browser compatible module for reading [rosbag](http://wiki.ros.org/rosbag) binary data files.","license":"Apache-2.0","readme":"# rosbag\n\n`rosbag` is a node.js & browser compatible module for reading [rosbag](http://wiki.ros.org/rosbag) binary data files.\n\n## Installation\n\n```\nnpm install rosbag\n```\n\nor\n\n```\nyarn add rosbag\n```\n\n## Quick start\n\nThe most common way to interact with a rosbag is to read data records for a specific set of topics. The rosbag format [encodes type information for topics](http://wiki.ros.org/msg), and `rosbag` reads this type information and parses the data records into JavaScript objects and arrays.\n\nHere is an example of reading messages from a rosbag in node.js:\n\n```js\nconst { open } = require('rosbag');\n\n// open a new bag at a given file location:\nconst bag = await open('../path/to/ros.bag');\n\n// read all messages from both the '/foo' and '/bar' topics:\nawait bag.readMessages({ topics: ['/foo', '/bar'] }, (result) => {\n  // topic is the topic the data record was in\n  // in this case it will be either '/foo' or '/bar'\n  console.log(result.topic);\n\n  // message is the parsed payload\n  // this payload will likely differ based on the topic\n  console.log(result.message);\n});\n```\n\n## API\n\n### Opening a new rosbag reader\n\n```js\n// @flow signature\nfunction open(fileOrPath: File | string) => Promise<Bag>\n```\n\nOpening a new rosbag reader is done with the `open` function. In the browser the function takes [a File instance](https://developer.mozilla.org/en-US/docs/Web/API/File) which you will generally get from a file input element. In node.js the function takes a string which should be the full path to a rosbag file. Node.js will read the file off of the disk. The promise will reject if there is an issue opening the file or if the file format is invalid, otherwise it will resolve with an instance of a `Bag`.\n\n### Bag instance\n\n```js\n// @flow signature\nclass Bag {\n  // the time of the earliest message in the bag\n  startTime: Time,\n\n  // the time of the last message in the bag\n  endTime: Time,\n\n  // a hash of connection records by their id\n  connections: { [number]: Connection },\n\n  // an array of ChunkInfos describing the chunks within the bag\n  chunkInfos: Array<ChunkInfo>,\n\n  // call to consume from the bag - see 'Consuming messages from the bag instance' below\n  readMessages(options: BagOptions, cb: (result: ReadResult) => void) => Promise<void>\n}\n```\n\n### Consuming messages from the bag instance\n\n`bag.readMessages` method returns a `Promise<void>` which resolves when the read operation is completed or rejects in the event of a read error. _During_ the read operation individual `ReadResult` objects are passed to the `callback` supplied to the `open` function. The `callback` may be called multiple times on the same tick as multiple data records can be encoded within a single binary chunk read within the bag reader.\n\n### BagOptions\n\n```js\n// @flow signature\nconst bagOptions = {\n\n  // an optional array of topics used to filter down\n  // which data records will be read\n  // the default is all records on all topics\n  topics?: Array<string>,\n\n  // an optional Time instance used to filter data records\n  // to only those which start on or after the given start time\n  // the default is undefined which will apply no filter\n  startTime?: Time,\n\n  // an optional Time instance used to filter data records\n  // to only those which end on or before the given end time\n  // the default is undefined which will apply no filter\n  endTime? Time,\n\n  // decompression callbacks\n  // if your bag is compressed you can supply a callback to decompress\n  // based on the compression type. The callback should accept a buffer of compressed bytes\n  // and return a buffer of uncompressed bytes\n  decompress?: {|\n    bz2?: (buffer: Buffer) => Buffer,\n    lz4?: (buffer: Buffer) => Buffer,\n  |}\n\n  // by default the individual parsed binary messages will be parsed based on their [ROS message definition](http://wiki.ros.org/msg)\n  // if you set noParse to true the read operation will skip the message parsing step\n  noParse?: boolean\n}\n```\n\nAll options are optional and used to filter down from the sometimes enormous and varied data records in a rosbag. One could omit all options & filter the messages in memory within the `readMessages` callback; however, due to the rosbag format optimizations can be made during reading & parsing which will yield _significant_ performance and memory gains if you specify topics and/or date ranges ahead of time.\n\n### ReadResult\n\n```js\n// @flow signature\nconst readResult {\n\n  // the topic from which the current record was read\n  topic: string,\n\n  // the parsed message contents as a JavaScript object\n  // this can contain nested complex types\n  // and arrays of complex & simple types\n  // this will be undefined if you supply { noParse: true } to `bag.readMessages`\n  message: { [string]: any },\n\n  // a Time instance - the receive time of the message\n  timestamp: Time\n\n  // the raw buffer data from the data record\n  // a node.js buffer in node & an array buffer in the browser\n  data: Array<int8>,\n\n  // the offset of the chunk being read\n  // starts at 0 and eventually increments to totalChunks\n  // useful for computing read progress as a percentage\n  chunkOffset: number,\n\n  // the total chunks to eventually be consumed\n  // during the current read operation\n  totalChunks: number,\n}\n```\n\n### Connection\n\n```js\n// @flow signature\nclass Connection {\n  // the id of the connection\n  conn: number,\n\n  // the topic for the connection\n  topic: string,\n\n  // the md5 hash for the connection message definition\n  md5sum: string,\n\n  // the rosbag formatted message definition for records on this connection's topic\n  messageDefinition: string,\n}\n```\n\n### Time\n\nThe ROS format represents time to the nanosecond granularity. In JavaScript it is stored as an instance of the Time class. The time class has conversion helper methods to go to and from JavaScript dates.\n\n```js\n// @flow signature\nclass Time {\n  // the seconds portion of the unix epoc\n  sec: number,\n\n  // the number of nanoseconds past the second of the unix epoc\n  nsec: number,\n\n  // the constructor expects a number for both the sec and nsec values\n  constructor(sec: number, nsec: number),\n\n  // convert this Time instance to a JavaScript date object\n  // note: this is a lossy conversion as JavaScript dates do not store nanoseconds\n  toDate(): Date,\n\n  // helper method to build a time instance from a JavaScript date object\n  static fromDate(Date): Time,\n\n  // returns a positive number if left is greater than right\n  // returns a negative number if right is greater than left\n  // returns 0 if the times are the same\n  // useful to sort an array of times:\n  // const times = [new Time(1, 1000), new Time(2, 2000), new Time(0, 100)]\n  // const sortedTimes = times.sort(Time.compare)\n  static compare(left: Time, right: Time): number,\n\n  // returns true if left is less than right, otherwise false\n  static isLessThan(left: Time, right: Time): boolean,\n\n  // returns true if left is greater than right, otherwise false\n  static isGreaterThan(left: Time, right: Time): boolean,\n\n  // returns true if the times are the same, otherwise false\n  static areSame(left: Time, right: Time): boolean,\n\n  // computes the sum of two times and returns a new time\n  static add(left: Time, right: Time): Time,\n}\n```\n\nYou can import the Time module like this: `const { Time } = require('rosbag')`\n\n## Supported platforms\n\nCurrently rosbag is used & heavily tested in `node@8.x` as well as google chrome (via webpack).  It should also work under all modern browsers which have the [FileReader](https://caniuse.com/#feat=filereader) and [typed array](https://caniuse.com/#feat=typedarrays) APIs available.  If you run into issues with Firefox, Edge, or Safari please feel free to open an issue or submit a pull request with a fix.\n\n## LICENSE\n\nThis software is licensed under the Apache License, version 2 (\"ALv2\"), quoted below.\n\nCopyright 2017-2018 GM Cruise\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License. You may obtain a copy of\nthe License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n","readmeFilename":"README.md"}