lordceaser-baileys 3.4.2 → 3.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/WAProto/index.js +115856 -5
  2. package/WAProto/package.json +1 -0
  3. package/index.js +37 -21
  4. package/lib/Utils/crypto.js +118 -8
  5. package/lib/Utils/lt-hash.js +8 -3
  6. package/lib/package.json +3 -0
  7. package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
  8. package/node_modules/@protobufjs/aspromise/README.md +13 -0
  9. package/node_modules/@protobufjs/aspromise/index.d.ts +13 -0
  10. package/node_modules/@protobufjs/aspromise/index.js +52 -0
  11. package/node_modules/@protobufjs/aspromise/package.json +21 -0
  12. package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
  13. package/node_modules/@protobufjs/base64/LICENSE +26 -0
  14. package/node_modules/@protobufjs/base64/README.md +19 -0
  15. package/node_modules/@protobufjs/base64/index.d.ts +32 -0
  16. package/node_modules/@protobufjs/base64/index.js +139 -0
  17. package/node_modules/@protobufjs/base64/package.json +21 -0
  18. package/node_modules/@protobufjs/base64/tests/index.js +46 -0
  19. package/node_modules/@protobufjs/codegen/LICENSE +26 -0
  20. package/node_modules/@protobufjs/codegen/README.md +49 -0
  21. package/node_modules/@protobufjs/codegen/index.d.ts +31 -0
  22. package/node_modules/@protobufjs/codegen/index.js +112 -0
  23. package/node_modules/@protobufjs/codegen/package.json +13 -0
  24. package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
  25. package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
  26. package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
  27. package/node_modules/@protobufjs/eventemitter/README.md +22 -0
  28. package/node_modules/@protobufjs/eventemitter/index.d.ts +45 -0
  29. package/node_modules/@protobufjs/eventemitter/index.js +86 -0
  30. package/node_modules/@protobufjs/eventemitter/package.json +21 -0
  31. package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
  32. package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
  33. package/node_modules/@protobufjs/fetch/LICENSE +26 -0
  34. package/node_modules/@protobufjs/fetch/README.md +13 -0
  35. package/node_modules/@protobufjs/fetch/index.d.ts +56 -0
  36. package/node_modules/@protobufjs/fetch/index.js +112 -0
  37. package/node_modules/@protobufjs/fetch/package.json +27 -0
  38. package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
  39. package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
  40. package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
  41. package/node_modules/@protobufjs/float/LICENSE +26 -0
  42. package/node_modules/@protobufjs/float/README.md +102 -0
  43. package/node_modules/@protobufjs/float/bench/index.js +87 -0
  44. package/node_modules/@protobufjs/float/bench/suite.js +46 -0
  45. package/node_modules/@protobufjs/float/index.d.ts +83 -0
  46. package/node_modules/@protobufjs/float/index.js +335 -0
  47. package/node_modules/@protobufjs/float/package.json +26 -0
  48. package/node_modules/@protobufjs/float/tests/index.js +100 -0
  49. package/node_modules/@protobufjs/path/LICENSE +26 -0
  50. package/node_modules/@protobufjs/path/README.md +19 -0
  51. package/node_modules/@protobufjs/path/index.d.ts +22 -0
  52. package/node_modules/@protobufjs/path/index.js +65 -0
  53. package/node_modules/@protobufjs/path/package.json +21 -0
  54. package/node_modules/@protobufjs/path/tests/index.js +60 -0
  55. package/node_modules/@protobufjs/pool/.npmignore +3 -0
  56. package/node_modules/@protobufjs/pool/LICENSE +26 -0
  57. package/node_modules/@protobufjs/pool/README.md +13 -0
  58. package/node_modules/@protobufjs/pool/index.d.ts +32 -0
  59. package/node_modules/@protobufjs/pool/index.js +48 -0
  60. package/node_modules/@protobufjs/pool/package.json +21 -0
  61. package/node_modules/@protobufjs/pool/tests/index.js +33 -0
  62. package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
  63. package/node_modules/@protobufjs/utf8/LICENSE +26 -0
  64. package/node_modules/@protobufjs/utf8/README.md +20 -0
  65. package/node_modules/@protobufjs/utf8/index.d.ts +24 -0
  66. package/node_modules/@protobufjs/utf8/index.js +115 -0
  67. package/node_modules/@protobufjs/utf8/package.json +21 -0
  68. package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
  69. package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
  70. package/node_modules/@protobufjs/utf8/tests/index.js +79 -0
  71. package/node_modules/@types/node/LICENSE +21 -0
  72. package/node_modules/@types/node/README.md +15 -0
  73. package/node_modules/@types/node/assert/strict.d.ts +8 -0
  74. package/node_modules/@types/node/assert.d.ts +1062 -0
  75. package/node_modules/@types/node/async_hooks.d.ts +605 -0
  76. package/node_modules/@types/node/buffer.buffer.d.ts +471 -0
  77. package/node_modules/@types/node/buffer.d.ts +1936 -0
  78. package/node_modules/@types/node/child_process.d.ts +1475 -0
  79. package/node_modules/@types/node/cluster.d.ts +577 -0
  80. package/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
  81. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  82. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  83. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  84. package/node_modules/@types/node/console.d.ts +452 -0
  85. package/node_modules/@types/node/constants.d.ts +21 -0
  86. package/node_modules/@types/node/crypto.d.ts +4590 -0
  87. package/node_modules/@types/node/dgram.d.ts +597 -0
  88. package/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  89. package/node_modules/@types/node/dns/promises.d.ts +479 -0
  90. package/node_modules/@types/node/dns.d.ts +871 -0
  91. package/node_modules/@types/node/domain.d.ts +170 -0
  92. package/node_modules/@types/node/events.d.ts +977 -0
  93. package/node_modules/@types/node/fs/promises.d.ts +1270 -0
  94. package/node_modules/@types/node/fs.d.ts +4375 -0
  95. package/node_modules/@types/node/globals.d.ts +172 -0
  96. package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  97. package/node_modules/@types/node/http.d.ts +2049 -0
  98. package/node_modules/@types/node/http2.d.ts +2712 -0
  99. package/node_modules/@types/node/https.d.ts +578 -0
  100. package/node_modules/@types/node/index.d.ts +93 -0
  101. package/node_modules/@types/node/inspector.generated.d.ts +3966 -0
  102. package/node_modules/@types/node/module.d.ts +539 -0
  103. package/node_modules/@types/node/net.d.ts +1031 -0
  104. package/node_modules/@types/node/os.d.ts +506 -0
  105. package/node_modules/@types/node/package.json +140 -0
  106. package/node_modules/@types/node/path.d.ts +200 -0
  107. package/node_modules/@types/node/perf_hooks.d.ts +961 -0
  108. package/node_modules/@types/node/process.d.ts +1961 -0
  109. package/node_modules/@types/node/punycode.d.ts +117 -0
  110. package/node_modules/@types/node/querystring.d.ts +152 -0
  111. package/node_modules/@types/node/readline/promises.d.ts +162 -0
  112. package/node_modules/@types/node/readline.d.ts +589 -0
  113. package/node_modules/@types/node/repl.d.ts +430 -0
  114. package/node_modules/@types/node/sea.d.ts +153 -0
  115. package/node_modules/@types/node/stream/consumers.d.ts +38 -0
  116. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  117. package/node_modules/@types/node/stream/web.d.ts +533 -0
  118. package/node_modules/@types/node/stream.d.ts +1698 -0
  119. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  120. package/node_modules/@types/node/test.d.ts +1787 -0
  121. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  122. package/node_modules/@types/node/timers.d.ts +286 -0
  123. package/node_modules/@types/node/tls.d.ts +1259 -0
  124. package/node_modules/@types/node/trace_events.d.ts +197 -0
  125. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  126. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  127. package/node_modules/@types/node/ts5.6/index.d.ts +93 -0
  128. package/node_modules/@types/node/tty.d.ts +208 -0
  129. package/node_modules/@types/node/url.d.ts +964 -0
  130. package/node_modules/@types/node/util.d.ts +2331 -0
  131. package/node_modules/@types/node/v8.d.ts +809 -0
  132. package/node_modules/@types/node/vm.d.ts +1001 -0
  133. package/node_modules/@types/node/wasi.d.ts +181 -0
  134. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  135. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  136. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  137. package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
  138. package/node_modules/@types/node/worker_threads.d.ts +715 -0
  139. package/node_modules/@types/node/zlib.d.ts +598 -0
  140. package/node_modules/curve25519-js/.prettierrc +6 -0
  141. package/node_modules/curve25519-js/LICENSE +19 -0
  142. package/node_modules/curve25519-js/README.md +111 -0
  143. package/node_modules/curve25519-js/lib/index.d.ts +69 -0
  144. package/node_modules/curve25519-js/lib/index.js +1669 -0
  145. package/node_modules/curve25519-js/package.json +34 -0
  146. package/node_modules/curve25519-js/tsconfig.json +20 -0
  147. package/node_modules/curve25519-js/tslint.json +10 -0
  148. package/node_modules/libsignal/LICENSE +621 -0
  149. package/node_modules/libsignal/README.md +64 -0
  150. package/node_modules/libsignal/index.d.ts +55 -0
  151. package/node_modules/libsignal/index.js +10 -0
  152. package/node_modules/libsignal/package.json +34 -0
  153. package/node_modules/libsignal/src/.eslintrc.json +31 -0
  154. package/node_modules/libsignal/src/WhisperTextProtocol.js +933 -0
  155. package/node_modules/libsignal/src/base_key_type.js +7 -0
  156. package/node_modules/libsignal/src/chain_type.js +6 -0
  157. package/node_modules/libsignal/src/crypto.d.ts +19 -0
  158. package/node_modules/libsignal/src/crypto.js +98 -0
  159. package/node_modules/libsignal/src/curve.d.ts +22 -0
  160. package/node_modules/libsignal/src/curve.js +142 -0
  161. package/node_modules/libsignal/src/errors.js +33 -0
  162. package/node_modules/libsignal/src/keyhelper.js +45 -0
  163. package/node_modules/libsignal/src/numeric_fingerprint.js +72 -0
  164. package/node_modules/libsignal/src/protobufs.js +10 -0
  165. package/node_modules/libsignal/src/protocol_address.js +40 -0
  166. package/node_modules/libsignal/src/queue_job.js +69 -0
  167. package/node_modules/libsignal/src/session_builder.js +164 -0
  168. package/node_modules/libsignal/src/session_cipher.js +336 -0
  169. package/node_modules/libsignal/src/session_record.js +316 -0
  170. package/node_modules/long/LICENSE +202 -0
  171. package/node_modules/long/README.md +286 -0
  172. package/node_modules/long/index.d.ts +2 -0
  173. package/node_modules/long/index.js +1581 -0
  174. package/node_modules/long/package.json +58 -0
  175. package/node_modules/long/types.d.ts +474 -0
  176. package/node_modules/long/umd/index.d.ts +3 -0
  177. package/node_modules/long/umd/index.js +1622 -0
  178. package/node_modules/long/umd/package.json +3 -0
  179. package/node_modules/long/umd/types.d.ts +474 -0
  180. package/node_modules/protobufjs/LICENSE +39 -0
  181. package/node_modules/protobufjs/README.md +727 -0
  182. package/node_modules/protobufjs/dist/light/protobuf.js +8094 -0
  183. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -0
  184. package/node_modules/protobufjs/dist/light/protobuf.min.js +8 -0
  185. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -0
  186. package/node_modules/protobufjs/dist/minimal/protobuf.js +2811 -0
  187. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -0
  188. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +8 -0
  189. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -0
  190. package/node_modules/protobufjs/dist/protobuf.js +9921 -0
  191. package/node_modules/protobufjs/dist/protobuf.js.map +1 -0
  192. package/node_modules/protobufjs/dist/protobuf.min.js +8 -0
  193. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -0
  194. package/node_modules/protobufjs/ext/debug/README.md +4 -0
  195. package/node_modules/protobufjs/ext/debug/index.js +71 -0
  196. package/node_modules/protobufjs/ext/descriptor/README.md +72 -0
  197. package/node_modules/protobufjs/ext/descriptor/index.d.ts +195 -0
  198. package/node_modules/protobufjs/ext/descriptor/index.js +1186 -0
  199. package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
  200. package/node_modules/protobufjs/google/LICENSE +27 -0
  201. package/node_modules/protobufjs/google/README.md +1 -0
  202. package/node_modules/protobufjs/google/api/annotations.json +83 -0
  203. package/node_modules/protobufjs/google/api/annotations.proto +11 -0
  204. package/node_modules/protobufjs/google/api/http.json +86 -0
  205. package/node_modules/protobufjs/google/api/http.proto +31 -0
  206. package/node_modules/protobufjs/google/protobuf/api.json +118 -0
  207. package/node_modules/protobufjs/google/protobuf/api.proto +34 -0
  208. package/node_modules/protobufjs/google/protobuf/descriptor.json +1382 -0
  209. package/node_modules/protobufjs/google/protobuf/descriptor.proto +535 -0
  210. package/node_modules/protobufjs/google/protobuf/source_context.json +20 -0
  211. package/node_modules/protobufjs/google/protobuf/source_context.proto +7 -0
  212. package/node_modules/protobufjs/google/protobuf/type.json +202 -0
  213. package/node_modules/protobufjs/google/protobuf/type.proto +89 -0
  214. package/node_modules/protobufjs/index.d.ts +2832 -0
  215. package/node_modules/protobufjs/index.js +4 -0
  216. package/node_modules/protobufjs/light.d.ts +2 -0
  217. package/node_modules/protobufjs/light.js +4 -0
  218. package/node_modules/protobufjs/minimal.d.ts +2 -0
  219. package/node_modules/protobufjs/minimal.js +4 -0
  220. package/node_modules/protobufjs/package.json +119 -0
  221. package/node_modules/protobufjs/scripts/postinstall.js +32 -0
  222. package/node_modules/protobufjs/src/common.js +399 -0
  223. package/node_modules/protobufjs/src/converter.js +318 -0
  224. package/node_modules/protobufjs/src/decoder.js +164 -0
  225. package/node_modules/protobufjs/src/encoder.js +103 -0
  226. package/node_modules/protobufjs/src/enum.js +226 -0
  227. package/node_modules/protobufjs/src/field.js +453 -0
  228. package/node_modules/protobufjs/src/index-light.js +104 -0
  229. package/node_modules/protobufjs/src/index-minimal.js +36 -0
  230. package/node_modules/protobufjs/src/index.js +12 -0
  231. package/node_modules/protobufjs/src/mapfield.js +126 -0
  232. package/node_modules/protobufjs/src/message.js +143 -0
  233. package/node_modules/protobufjs/src/method.js +160 -0
  234. package/node_modules/protobufjs/src/namespace.js +558 -0
  235. package/node_modules/protobufjs/src/object.js +382 -0
  236. package/node_modules/protobufjs/src/oneof.js +222 -0
  237. package/node_modules/protobufjs/src/parse.js +992 -0
  238. package/node_modules/protobufjs/src/reader.js +446 -0
  239. package/node_modules/protobufjs/src/reader_buffer.js +51 -0
  240. package/node_modules/protobufjs/src/root.js +412 -0
  241. package/node_modules/protobufjs/src/roots.js +18 -0
  242. package/node_modules/protobufjs/src/rpc/service.js +142 -0
  243. package/node_modules/protobufjs/src/rpc.js +36 -0
  244. package/node_modules/protobufjs/src/service.js +193 -0
  245. package/node_modules/protobufjs/src/tokenize.js +416 -0
  246. package/node_modules/protobufjs/src/type.js +632 -0
  247. package/node_modules/protobufjs/src/types.js +196 -0
  248. package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
  249. package/node_modules/protobufjs/src/util/fs.js +11 -0
  250. package/node_modules/protobufjs/src/util/longbits.js +200 -0
  251. package/node_modules/protobufjs/src/util/minimal.js +491 -0
  252. package/node_modules/protobufjs/src/util/patterns.js +7 -0
  253. package/node_modules/protobufjs/src/util.js +230 -0
  254. package/node_modules/protobufjs/src/verifier.js +180 -0
  255. package/node_modules/protobufjs/src/wrappers.js +111 -0
  256. package/node_modules/protobufjs/src/writer.js +467 -0
  257. package/node_modules/protobufjs/src/writer_buffer.js +85 -0
  258. package/node_modules/protobufjs/tsconfig.json +8 -0
  259. package/node_modules/undici-types/LICENSE +21 -0
  260. package/node_modules/undici-types/README.md +6 -0
  261. package/node_modules/undici-types/agent.d.ts +31 -0
  262. package/node_modules/undici-types/api.d.ts +43 -0
  263. package/node_modules/undici-types/balanced-pool.d.ts +29 -0
  264. package/node_modules/undici-types/cache.d.ts +36 -0
  265. package/node_modules/undici-types/client.d.ts +108 -0
  266. package/node_modules/undici-types/connector.d.ts +34 -0
  267. package/node_modules/undici-types/content-type.d.ts +21 -0
  268. package/node_modules/undici-types/cookies.d.ts +28 -0
  269. package/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  270. package/node_modules/undici-types/dispatcher.d.ts +256 -0
  271. package/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  272. package/node_modules/undici-types/errors.d.ts +149 -0
  273. package/node_modules/undici-types/eventsource.d.ts +61 -0
  274. package/node_modules/undici-types/fetch.d.ts +209 -0
  275. package/node_modules/undici-types/file.d.ts +39 -0
  276. package/node_modules/undici-types/filereader.d.ts +54 -0
  277. package/node_modules/undici-types/formdata.d.ts +108 -0
  278. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  279. package/node_modules/undici-types/global-origin.d.ts +7 -0
  280. package/node_modules/undici-types/handlers.d.ts +15 -0
  281. package/node_modules/undici-types/header.d.ts +4 -0
  282. package/node_modules/undici-types/index.d.ts +71 -0
  283. package/node_modules/undici-types/interceptors.d.ts +17 -0
  284. package/node_modules/undici-types/mock-agent.d.ts +50 -0
  285. package/node_modules/undici-types/mock-client.d.ts +25 -0
  286. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  287. package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  288. package/node_modules/undici-types/mock-pool.d.ts +25 -0
  289. package/node_modules/undici-types/package.json +55 -0
  290. package/node_modules/undici-types/patch.d.ts +33 -0
  291. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  292. package/node_modules/undici-types/pool.d.ts +39 -0
  293. package/node_modules/undici-types/proxy-agent.d.ts +28 -0
  294. package/node_modules/undici-types/readable.d.ts +65 -0
  295. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  296. package/node_modules/undici-types/retry-handler.d.ts +116 -0
  297. package/node_modules/undici-types/util.d.ts +18 -0
  298. package/node_modules/undici-types/webidl.d.ts +228 -0
  299. package/node_modules/undici-types/websocket.d.ts +150 -0
  300. package/package.json +65 -29
  301. package/WAProto/_orig.js +0 -115856
@@ -0,0 +1,83 @@
1
+ var tape = require("tape");
2
+
3
+ var EventEmitter = require("..");
4
+
5
+ tape.test("eventemitter", function(test) {
6
+
7
+ var ee = new EventEmitter();
8
+ var fn;
9
+ var ctx = {};
10
+
11
+ test.equal(Object.getPrototypeOf(ee._listeners), null, "should not inherit listener lookup keys");
12
+
13
+ test.doesNotThrow(function() {
14
+ ee.emit("a", 1);
15
+ ee.off();
16
+ ee.off("a");
17
+ ee.off("a", function() {});
18
+ }, "should not throw if no listeners are registered");
19
+
20
+ test.equal(ee.on("a", function(arg1) {
21
+ test.equal(this, ctx, "should be called with this = ctx");
22
+ test.equal(arg1, 1, "should be called with arg1 = 1");
23
+ }, ctx), ee, "should return itself when registering events");
24
+ ee.emit("a", 1);
25
+
26
+ ee.off("a");
27
+ test.same(Object.keys(ee._listeners), [ "a" ], "should keep the event key when calling off(evt)");
28
+ test.same(ee._listeners.a, [], "should remove all listeners of the respective event when calling off(evt)");
29
+
30
+ ee.off();
31
+ test.equal(Object.getPrototypeOf(ee._listeners), null, "should keep the listener table isolated when just calling off()");
32
+ test.same(Object.keys(ee._listeners), [], "should remove all listeners when just calling off()");
33
+
34
+ ee.on("a", fn = function(arg1) {
35
+ test.equal(this, ctx, "should be called with this = ctx");
36
+ test.equal(arg1, 1, "should be called with arg1 = 1");
37
+ }, ctx).emit("a", 1);
38
+
39
+ ee.off("a", fn);
40
+ test.same(Object.keys(ee._listeners), [ "a" ], "should keep the event key when calling off(evt, fn)");
41
+ test.same(ee._listeners.a, [], "should remove the exact listener when calling off(evt, fn)");
42
+
43
+ ee.on("a", function() {
44
+ test.equal(this, ee, "should be called with this = ee");
45
+ }).emit("a");
46
+
47
+ test.doesNotThrow(function() {
48
+ ee.off("a", fn);
49
+ }, "should not throw if no such listener is found");
50
+
51
+ test.test(test.name + " - special event names", function(test) {
52
+ var ee = new EventEmitter();
53
+ var calls = 0;
54
+
55
+ test.doesNotThrow(function() {
56
+ ee.off("__proto__", function() {});
57
+ }, "should not throw when removing an absent special event listener");
58
+
59
+ ee.on("__proto__", function(arg) {
60
+ ++calls;
61
+ test.equal(arg, 1, "should pass arguments for __proto__ events");
62
+ });
63
+ ee.on("constructor", function(arg) {
64
+ ++calls;
65
+ test.equal(arg, 2, "should pass arguments for constructor events");
66
+ });
67
+ ee.emit("__proto__", 1);
68
+ ee.emit("constructor", 2);
69
+
70
+ test.equal(calls, 2, "should dispatch special event names");
71
+ test.equal(Object.getPrototypeOf(ee._listeners), null, "should keep the listener table isolated");
72
+ test.ok(Object.prototype.hasOwnProperty.call(ee._listeners, "__proto__"), "should store __proto__ as an own event key");
73
+ test.ok(Object.prototype.hasOwnProperty.call(ee._listeners, "constructor"), "should store constructor as an own event key");
74
+
75
+ ee.off("__proto__");
76
+ ee.off("constructor");
77
+ test.same(ee._listeners.__proto__, [], "should clear __proto__ listeners");
78
+ test.same(ee._listeners.constructor, [], "should clear constructor listeners");
79
+ test.end();
80
+ });
81
+
82
+ test.end();
83
+ });
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## [1.1.1](https://github.com/protobufjs/protobuf.js/compare/fetch-v1.1.0...fetch-v1.1.1) (2026-05-17)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Backport bundler-safe optional module lookups ([#2254](https://github.com/protobufjs/protobuf.js/issues/2254)) ([0853a62](https://github.com/protobufjs/protobuf.js/commit/0853a625680f9247596b84ef48082b8f4e554797))
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2016, Daniel Wirtz All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ * Neither the name of its author, nor the names of its contributors
13
+ may be used to endorse or promote products derived from this software
14
+ without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,13 @@
1
+ @protobufjs/fetch
2
+ =================
3
+ [![npm](https://img.shields.io/npm/v/@protobufjs/fetch.svg)](https://www.npmjs.com/package/@protobufjs/fetch)
4
+
5
+ Fetches the contents of a file accross node and browsers.
6
+
7
+ API
8
+ ---
9
+
10
+ * **fetch(path: `string`, [options: { binary: boolean } ], [callback: `function(error: ?Error, [contents: string])`]): `Promise<string|Uint8Array>|undefined`**
11
+ Fetches the contents of a file.
12
+
13
+ **License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
@@ -0,0 +1,56 @@
1
+ export = fetch;
2
+
3
+ /**
4
+ * Node-style callback as used by {@link util.fetch}.
5
+ * @typedef FetchCallback
6
+ * @type {function}
7
+ * @param {?Error} error Error, if any, otherwise `null`
8
+ * @param {string} [contents] File contents, if there hasn't been an error
9
+ * @returns {undefined}
10
+ */
11
+ type FetchCallback = (error: Error, contents?: string) => void;
12
+
13
+ /**
14
+ * Options as used by {@link util.fetch}.
15
+ * @typedef IFetchOptions
16
+ * @type {Object}
17
+ * @property {boolean} [binary=false] Whether expecting a binary response
18
+ * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
19
+ */
20
+
21
+ interface IFetchOptions {
22
+ binary?: boolean;
23
+ xhr?: boolean;
24
+ }
25
+
26
+ /**
27
+ * Fetches the contents of a file.
28
+ * @memberof util
29
+ * @param {string} filename File path or url
30
+ * @param {IFetchOptions} options Fetch options
31
+ * @param {FetchCallback} callback Callback function
32
+ * @returns {undefined}
33
+ */
34
+ declare function fetch(filename: string, options: IFetchOptions, callback: FetchCallback): void;
35
+
36
+ /**
37
+ * Fetches the contents of a file.
38
+ * @name util.fetch
39
+ * @function
40
+ * @param {string} path File path or url
41
+ * @param {FetchCallback} callback Callback function
42
+ * @returns {undefined}
43
+ * @variation 2
44
+ */
45
+ declare function fetch(path: string, callback: FetchCallback): void;
46
+
47
+ /**
48
+ * Fetches the contents of a file.
49
+ * @name util.fetch
50
+ * @function
51
+ * @param {string} path File path or url
52
+ * @param {IFetchOptions} [options] Fetch options
53
+ * @returns {Promise<string|Uint8Array>} Promise
54
+ * @variation 3
55
+ */
56
+ declare function fetch(path: string, options?: IFetchOptions): Promise<(string|Uint8Array)>;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ module.exports = fetch;
3
+
4
+ var asPromise = require("@protobufjs/aspromise"),
5
+ fs = require("./util/fs");
6
+
7
+ /**
8
+ * Node-style callback as used by {@link util.fetch}.
9
+ * @typedef FetchCallback
10
+ * @type {function}
11
+ * @param {?Error} error Error, if any, otherwise `null`
12
+ * @param {string} [contents] File contents, if there hasn't been an error
13
+ * @returns {undefined}
14
+ */
15
+
16
+ /**
17
+ * Options as used by {@link util.fetch}.
18
+ * @interface IFetchOptions
19
+ * @property {boolean} [binary=false] Whether expecting a binary response
20
+ * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
21
+ */
22
+
23
+ /**
24
+ * Fetches the contents of a file.
25
+ * @memberof util
26
+ * @param {string} filename File path or url
27
+ * @param {IFetchOptions} options Fetch options
28
+ * @param {FetchCallback} callback Callback function
29
+ * @returns {undefined}
30
+ */
31
+ function fetch(filename, options, callback) {
32
+ if (typeof options === "function") {
33
+ callback = options;
34
+ options = {};
35
+ } else if (!options)
36
+ options = {};
37
+
38
+ if (!callback)
39
+ return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
40
+
41
+ // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
42
+ if (!options.xhr && fs && fs.readFile)
43
+ return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
44
+ return err && typeof XMLHttpRequest !== "undefined"
45
+ ? fetch.xhr(filename, options, callback)
46
+ : err
47
+ ? callback(err)
48
+ : callback(null, options.binary ? contents : contents.toString("utf8"));
49
+ });
50
+
51
+ // use the XHR version otherwise.
52
+ return fetch.xhr(filename, options, callback);
53
+ }
54
+
55
+ /**
56
+ * Fetches the contents of a file.
57
+ * @name util.fetch
58
+ * @function
59
+ * @param {string} path File path or url
60
+ * @param {FetchCallback} callback Callback function
61
+ * @returns {undefined}
62
+ * @variation 2
63
+ */
64
+
65
+ /**
66
+ * Fetches the contents of a file.
67
+ * @name util.fetch
68
+ * @function
69
+ * @param {string} path File path or url
70
+ * @param {IFetchOptions} [options] Fetch options
71
+ * @returns {Promise<string|Uint8Array>} Promise
72
+ * @variation 3
73
+ */
74
+
75
+ /**/
76
+ fetch.xhr = function fetch_xhr(filename, options, callback) {
77
+ var xhr = new XMLHttpRequest();
78
+ xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
79
+
80
+ if (xhr.readyState !== 4)
81
+ return undefined;
82
+
83
+ // local cors security errors return status 0 / empty string, too. afaik this cannot be
84
+ // reliably distinguished from an actually empty file for security reasons. feel free
85
+ // to send a pull request if you are aware of a solution.
86
+ if (xhr.status !== 0 && xhr.status !== 200)
87
+ return callback(Error("status " + xhr.status));
88
+
89
+ // if binary data is expected, make sure that some sort of array is returned, even if
90
+ // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
91
+ if (options.binary) {
92
+ var buffer = xhr.response;
93
+ if (!buffer) {
94
+ buffer = [];
95
+ for (var i = 0; i < xhr.responseText.length; ++i)
96
+ buffer.push(xhr.responseText.charCodeAt(i) & 255);
97
+ }
98
+ return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
99
+ }
100
+ return callback(null, xhr.responseText);
101
+ };
102
+
103
+ if (options.binary) {
104
+ // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
105
+ if ("overrideMimeType" in xhr)
106
+ xhr.overrideMimeType("text/plain; charset=x-user-defined");
107
+ xhr.responseType = "arraybuffer";
108
+ }
109
+
110
+ xhr.open("GET", filename);
111
+ xhr.send();
112
+ };
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@protobufjs/fetch",
3
+ "description": "Fetches the contents of a file accross node and browsers.",
4
+ "version": "1.1.1",
5
+ "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/dcodeIO/protobuf.js.git"
9
+ },
10
+ "dependencies": {
11
+ "@protobufjs/aspromise": "^1.1.1"
12
+ },
13
+ "license": "BSD-3-Clause",
14
+ "main": "index.js",
15
+ "types": "index.d.ts",
16
+ "browser": {
17
+ "fs": false
18
+ },
19
+ "devDependencies": {
20
+ "istanbul": "^0.4.5",
21
+ "tape": "^5.0.0"
22
+ },
23
+ "scripts": {
24
+ "test": "tape tests/*.js",
25
+ "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
26
+ }
27
+ }
@@ -0,0 +1,158 @@
1
+ var tape = require("tape");
2
+
3
+ var fetch = require("..");
4
+
5
+ tape.test("fetch", function(test) {
6
+
7
+ if (typeof Promise !== "undefined")
8
+ test.test(test.name + " - promise", function(test) {
9
+ var promise = fetch("NOTFOUND");
10
+ test.plan(2);
11
+ test.ok(promise instanceof Promise, "should return a promise if callback has been omitted");
12
+ promise
13
+ .then(function() {
14
+ test.fail("should not resolve");
15
+ })
16
+ .catch(function(err) {
17
+ test.ok(err, "should reject with an error");
18
+ });
19
+ });
20
+
21
+ test.test(test.name + " - node fs", function(test) {
22
+
23
+ test.test(test.name + " - string", function(test) {
24
+ test.plan(2);
25
+ fetch(require.resolve("./data/file.txt"), function(err, contents) {
26
+ test.notOk(err, "should not return an error");
27
+ test.equal(contents, "file.txt", "should return contents as a string");
28
+ });
29
+ });
30
+
31
+ test.test(test.name + " - binary", function(test) {
32
+ test.plan(2);
33
+ fetch(require.resolve("./data/file.txt"), { binary: true }, function(err, contents) {
34
+ test.notOk(err, "should not return an error");
35
+ test.same(contents, new Buffer("file.txt", "utf8"), "should return contents as a Buffer");
36
+ });
37
+ });
38
+
39
+ test.test(test.name + " - fallback", function(test) {
40
+ test.plan(2);
41
+ global.XMLHttpRequest = fakeXHR(0);
42
+ fetch("file.txt", function(err, contents) {
43
+ delete global.XMLHttpRequest;
44
+ test.notOk(err, "should not return an error");
45
+ test.same(contents, "file.txt", "should return contents as a string");
46
+ });
47
+ });
48
+
49
+ test.end();
50
+ });
51
+
52
+ test.test(test.name + " - XMLHttpRequest", function(test) {
53
+
54
+ test.test(test.name + " - 404", function(test) {
55
+ global.XMLHttpRequest = fakeXHR(404);
56
+ fetch("file.txt", { xhr: true }, function(err) {
57
+ delete global.XMLHttpRequest;
58
+ test.ok(err, "should return an error");
59
+ test.end();
60
+ });
61
+ });
62
+
63
+ test.test(test.name + " - string", function(test) {
64
+ global.XMLHttpRequest = fakeXHR(0);
65
+ test.plan(2);
66
+ fetch("file.txt", { xhr: true }, function(err, contents) {
67
+ delete global.XMLHttpRequest;
68
+ test.notOk(err, "should not return an error");
69
+ test.equal(contents, "file.txt", "should return contents as a string");
70
+ });
71
+ });
72
+
73
+ test.test(test.name + " - binary", function(test) {
74
+ global.XMLHttpRequest = fakeXHR(200);
75
+ test.plan(2);
76
+ fetch("file.txt", { xhr: true, binary: true }, function(err, contents) {
77
+ delete global.XMLHttpRequest;
78
+ test.notOk(err, "should not return an error");
79
+ test.same(contents, new Uint8Array([0x66, 0x69, 0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74]), "should return contents as an Uint8Array");
80
+ });
81
+ });
82
+
83
+ });
84
+
85
+ test.test(test.name + " - XMLHttpRequest (ancient)", function(test) {
86
+
87
+ test.test(test.name + " - string", function(test) {
88
+ global.XMLHttpRequest = fakeXHR(0, true);
89
+ test.plan(2);
90
+ fetch("file.txt", { xhr: true }, function(err, contents) {
91
+ delete global.XMLHttpRequest;
92
+ test.notOk(err, "should not return an error");
93
+ test.equal(contents, "file.txt", "should return contents as a string");
94
+ });
95
+ });
96
+
97
+ test.test(test.name + " - binary", function(test) {
98
+ global.XMLHttpRequest = fakeXHR(200, true);
99
+ var U8 = global.Uint8Array;
100
+ delete global.Uint8Array;
101
+ test.plan(2);
102
+ fetch("file.txt", { xhr: true, binary: true }, function(err, contents) {
103
+ delete global.XMLHttpRequest;
104
+ global.Uint8Array = U8;
105
+ test.notOk(err, "should not return an error");
106
+ test.same(contents, [0x66, 0x69, 0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74], "should return contents as an Array");
107
+ });
108
+ });
109
+
110
+ });
111
+
112
+ });
113
+
114
+ function fakeXHR(status, ancient) {
115
+
116
+ var UNSENT = 0,
117
+ OPENED = 1,
118
+ HEADERS_RECEIVED = 2,
119
+ LOADING = 3,
120
+ DONE = 4;
121
+
122
+ function XMLHttpRequest() {
123
+ this.status = 0;
124
+ this.readyState = UNSENT;
125
+ }
126
+ if (!ancient)
127
+ XMLHttpRequest.prototype.overrideMimeType = function(mimeType) {
128
+ this._mimeType = mimeType;
129
+ };
130
+ XMLHttpRequest.prototype.open = function open(method, path) {
131
+ this._method = method;
132
+ this._path = path;
133
+ this.readyState = OPENED;
134
+ };
135
+ XMLHttpRequest.prototype.send = function send() {
136
+ var self = this;
137
+ setTimeout(function() {
138
+ self.onreadystatechange(); // opened
139
+ self.readyState = HEADERS_RECEIVED;
140
+ self.onreadystatechange();
141
+ self.readyState = LOADING;
142
+ self.onreadystatechange();
143
+ self.readyState = DONE;
144
+ self.status = status;
145
+ if (self.responseType === "arraybuffer" && !ancient) {
146
+ var buf = new Buffer(self._path, "utf8");
147
+ var abuf = new ArrayBuffer(buf.length);
148
+ var view = new Uint8Array(abuf);
149
+ for (var i = 0; i < buf.length; ++i)
150
+ view[i] = buf[i];
151
+ self.response = abuf;
152
+ } else
153
+ self.responseText = self._path;
154
+ self.onreadystatechange();
155
+ });
156
+ };
157
+ return XMLHttpRequest;
158
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var fs = null;
4
+ try {
5
+ fs = require(/* webpackIgnore: true */ "fs");
6
+ if (!fs || !fs.readFile || !fs.readFileSync)
7
+ fs = null;
8
+ } catch (e) {
9
+ // `fs` is unavailable in browsers and browser-like bundles.
10
+ }
11
+ module.exports = fs;
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2016, Daniel Wirtz All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ * Neither the name of its author, nor the names of its contributors
13
+ may be used to endorse or promote products derived from this software
14
+ without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,102 @@
1
+ @protobufjs/float
2
+ =================
3
+ [![npm](https://img.shields.io/npm/v/@protobufjs/float.svg)](https://www.npmjs.com/package/@protobufjs/float)
4
+
5
+ Reads / writes floats / doubles from / to buffers in both modern and ancient browsers. Fast.
6
+
7
+ API
8
+ ---
9
+
10
+ * **writeFloatLE(val: `number`, buf: `Uint8Array`, pos: `number`)**<br />
11
+ Writes a 32 bit float to a buffer using little endian byte order.
12
+
13
+ * **writeFloatBE(val: `number`, buf: `Uint8Array`, pos: `number`)**<br />
14
+ Writes a 32 bit float to a buffer using big endian byte order.
15
+
16
+ * **readFloatLE(buf: `Uint8Array`, pos: `number`): `number`**<br />
17
+ Reads a 32 bit float from a buffer using little endian byte order.
18
+
19
+ * **readFloatBE(buf: `Uint8Array`, pos: `number`): `number`**<br />
20
+ Reads a 32 bit float from a buffer using big endian byte order.
21
+
22
+ * **writeDoubleLE(val: `number`, buf: `Uint8Array`, pos: `number`)**<br />
23
+ Writes a 64 bit double to a buffer using little endian byte order.
24
+
25
+ * **writeDoubleBE(val: `number`, buf: `Uint8Array`, pos: `number`)**<br />
26
+ Writes a 64 bit double to a buffer using big endian byte order.
27
+
28
+ * **readDoubleLE(buf: `Uint8Array`, pos: `number`): `number`**<br />
29
+ Reads a 64 bit double from a buffer using little endian byte order.
30
+
31
+ * **readDoubleBE(buf: `Uint8Array`, pos: `number`): `number`**<br />
32
+ Reads a 64 bit double from a buffer using big endian byte order.
33
+
34
+ Performance
35
+ -----------
36
+ There is a simple benchmark included comparing raw read/write performance of this library (float), float's fallback for old browsers, the [ieee754](https://www.npmjs.com/package/ieee754) module and node's [buffer](https://nodejs.org/api/buffer.html). On an i7-2600k running node 6.9.1 it yields:
37
+
38
+ ```
39
+ benchmarking writeFloat performance ...
40
+
41
+ float x 42,741,625 ops/sec ±1.75% (81 runs sampled)
42
+ float (fallback) x 11,272,532 ops/sec ±1.12% (85 runs sampled)
43
+ ieee754 x 8,653,337 ops/sec ±1.18% (84 runs sampled)
44
+ buffer x 12,412,414 ops/sec ±1.41% (83 runs sampled)
45
+ buffer (noAssert) x 13,471,149 ops/sec ±1.09% (84 runs sampled)
46
+
47
+ float was fastest
48
+ float (fallback) was 73.5% slower
49
+ ieee754 was 79.6% slower
50
+ buffer was 70.9% slower
51
+ buffer (noAssert) was 68.3% slower
52
+
53
+ benchmarking readFloat performance ...
54
+
55
+ float x 44,382,729 ops/sec ±1.70% (84 runs sampled)
56
+ float (fallback) x 20,925,938 ops/sec ±0.86% (87 runs sampled)
57
+ ieee754 x 17,189,009 ops/sec ±1.01% (87 runs sampled)
58
+ buffer x 10,518,437 ops/sec ±1.04% (83 runs sampled)
59
+ buffer (noAssert) x 11,031,636 ops/sec ±1.15% (87 runs sampled)
60
+
61
+ float was fastest
62
+ float (fallback) was 52.5% slower
63
+ ieee754 was 61.0% slower
64
+ buffer was 76.1% slower
65
+ buffer (noAssert) was 75.0% slower
66
+
67
+ benchmarking writeDouble performance ...
68
+
69
+ float x 38,624,906 ops/sec ±0.93% (83 runs sampled)
70
+ float (fallback) x 10,457,811 ops/sec ±1.54% (85 runs sampled)
71
+ ieee754 x 7,681,130 ops/sec ±1.11% (83 runs sampled)
72
+ buffer x 12,657,876 ops/sec ±1.03% (83 runs sampled)
73
+ buffer (noAssert) x 13,372,795 ops/sec ±0.84% (85 runs sampled)
74
+
75
+ float was fastest
76
+ float (fallback) was 73.1% slower
77
+ ieee754 was 80.1% slower
78
+ buffer was 67.3% slower
79
+ buffer (noAssert) was 65.3% slower
80
+
81
+ benchmarking readDouble performance ...
82
+
83
+ float x 40,527,888 ops/sec ±1.05% (84 runs sampled)
84
+ float (fallback) x 18,696,480 ops/sec ±0.84% (86 runs sampled)
85
+ ieee754 x 14,074,028 ops/sec ±1.04% (87 runs sampled)
86
+ buffer x 10,092,367 ops/sec ±1.15% (84 runs sampled)
87
+ buffer (noAssert) x 10,623,793 ops/sec ±0.96% (84 runs sampled)
88
+
89
+ float was fastest
90
+ float (fallback) was 53.8% slower
91
+ ieee754 was 65.3% slower
92
+ buffer was 75.1% slower
93
+ buffer (noAssert) was 73.8% slower
94
+ ```
95
+
96
+ To run it yourself:
97
+
98
+ ```
99
+ $> npm run bench
100
+ ```
101
+
102
+ **License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)