@openclaw/feishu 2026.6.8 → 2026.6.9
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.
- package/dist/api.js +79 -24
- package/dist/{channel-DwygSth-.js → channel-DF8jqwhL.js} +4 -4
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CrqKcXaU.js → channel.runtime-C4eAoxAR.js} +5 -5
- package/dist/{client-BhMNZBJD.js → client-BwgAJuvo.js} +14 -9
- package/dist/{drive-8o3Omlnd.js → drive-djUl8IRC.js} +16 -3
- package/dist/{monitor-_1eNsUVp.js → monitor-UZJ1bdoG.js} +2 -2
- package/dist/{monitor.account-BhoLA1Y0.js → monitor.account-Bc_8o_b6.js} +95 -51
- package/dist/{monitor.state-QV66eUNA.js → monitor.state-CGL1occz.js} +1 -1
- package/dist/{probe-BjKRV7em.js → probe-EyeJQb3C.js} +1 -1
- package/dist/{send-B3kteMF8.js → send-CMyK8JGr.js} +33 -25
- package/dist/setup-api.js +1 -1
- package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
- package/node_modules/@protobufjs/aspromise/README.md +13 -0
- package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
- package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
- package/node_modules/@protobufjs/aspromise/package.json +21 -0
- package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
- package/node_modules/@protobufjs/base64/LICENSE +26 -0
- package/node_modules/@protobufjs/base64/README.md +19 -0
- package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
- package/node_modules/@protobufjs/base64/package.json +21 -0
- package/node_modules/@protobufjs/base64/tests/index.js +46 -0
- package/node_modules/@protobufjs/codegen/LICENSE +26 -0
- package/node_modules/@protobufjs/codegen/README.md +49 -0
- package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
- package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -113
- package/node_modules/@protobufjs/codegen/package.json +13 -0
- package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
- package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
- package/node_modules/@protobufjs/eventemitter/README.md +22 -0
- package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
- package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
- package/node_modules/@protobufjs/eventemitter/package.json +21 -0
- package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
- package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/fetch/LICENSE +26 -0
- package/node_modules/@protobufjs/fetch/README.md +13 -0
- package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
- package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
- package/node_modules/@protobufjs/fetch/package.json +27 -0
- package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
- package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
- package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
- package/node_modules/@protobufjs/float/LICENSE +26 -0
- package/node_modules/@protobufjs/float/README.md +102 -0
- package/node_modules/@protobufjs/float/bench/index.js +87 -0
- package/node_modules/@protobufjs/float/bench/suite.js +46 -0
- package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
- package/node_modules/@protobufjs/float/package.json +26 -0
- package/node_modules/@protobufjs/float/tests/index.js +100 -0
- package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/inquire/LICENSE +26 -0
- package/node_modules/@protobufjs/inquire/README.md +13 -0
- package/node_modules/{protobufjs/src/util/inquire.d.ts → @protobufjs/inquire/index.d.ts} +10 -10
- package/node_modules/{protobufjs/src/util/inquire.js → @protobufjs/inquire/index.js} +38 -38
- package/node_modules/@protobufjs/inquire/package.json +21 -0
- package/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/index.js +20 -0
- package/node_modules/@protobufjs/path/LICENSE +26 -0
- package/node_modules/@protobufjs/path/README.md +19 -0
- package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
- package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -72
- package/node_modules/@protobufjs/path/package.json +21 -0
- package/node_modules/@protobufjs/path/tests/index.js +60 -0
- package/node_modules/@protobufjs/pool/.npmignore +3 -0
- package/node_modules/@protobufjs/pool/LICENSE +26 -0
- package/node_modules/@protobufjs/pool/README.md +13 -0
- package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
- package/node_modules/@protobufjs/pool/package.json +21 -0
- package/node_modules/@protobufjs/pool/tests/index.js +33 -0
- package/node_modules/@protobufjs/utf8/LICENSE +26 -0
- package/node_modules/@protobufjs/utf8/README.md +20 -0
- package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
- package/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -130
- package/node_modules/@protobufjs/utf8/package.json +21 -0
- package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
- package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
- package/node_modules/@protobufjs/utf8/tests/index.js +74 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +59 -0
- package/node_modules/@types/node/assert.d.ts +950 -0
- package/node_modules/@types/node/async_hooks.d.ts +711 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +466 -0
- package/node_modules/@types/node/buffer.d.ts +1765 -0
- package/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +93 -0
- package/node_modules/@types/node/constants.d.ts +14 -0
- package/node_modules/@types/node/crypto.d.ts +4058 -0
- package/node_modules/@types/node/dgram.d.ts +537 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
- package/node_modules/@types/node/dns/promises.d.ts +497 -0
- package/node_modules/@types/node/dns.d.ts +876 -0
- package/node_modules/@types/node/domain.d.ts +150 -0
- package/node_modules/@types/node/events.d.ts +1008 -0
- package/node_modules/@types/node/fs/promises.d.ts +1468 -0
- package/node_modules/@types/node/fs.d.ts +4780 -0
- package/node_modules/@types/node/globals.d.ts +150 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
- package/node_modules/@types/node/http.d.ts +2147 -0
- package/node_modules/@types/node/http2.d.ts +2485 -0
- package/node_modules/@types/node/https.d.ts +400 -0
- package/node_modules/@types/node/index.d.ts +117 -0
- package/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/@types/node/inspector.d.ts +264 -0
- package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
- package/node_modules/@types/node/module.d.ts +755 -0
- package/node_modules/@types/node/net.d.ts +970 -0
- package/node_modules/@types/node/os.d.ts +498 -0
- package/node_modules/@types/node/package.json +155 -0
- package/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/node/path.d.ts +178 -0
- package/node_modules/@types/node/perf_hooks.d.ts +612 -0
- package/node_modules/@types/node/process.d.ts +2204 -0
- package/node_modules/@types/node/punycode.d.ts +89 -0
- package/node_modules/@types/node/querystring.d.ts +139 -0
- package/node_modules/@types/node/quic.d.ts +897 -0
- package/node_modules/@types/node/readline/promises.d.ts +158 -0
- package/node_modules/@types/node/readline.d.ts +507 -0
- package/node_modules/@types/node/repl.d.ts +420 -0
- package/node_modules/@types/node/sea.d.ts +47 -0
- package/node_modules/@types/node/sqlite.d.ts +1068 -0
- package/node_modules/@types/node/stream/consumers.d.ts +114 -0
- package/node_modules/@types/node/stream/iter.d.ts +301 -0
- package/node_modules/@types/node/stream/promises.d.ts +211 -0
- package/node_modules/@types/node/stream/web.d.ts +300 -0
- package/node_modules/@types/node/stream.d.ts +1774 -0
- package/node_modules/@types/node/string_decoder.d.ts +27 -0
- package/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/@types/node/test.d.ts +2279 -0
- package/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@types/node/timers.d.ts +149 -0
- package/node_modules/@types/node/tls.d.ts +1193 -0
- package/node_modules/@types/node/trace_events.d.ts +103 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +119 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
- package/node_modules/@types/node/tty.d.ts +225 -0
- package/node_modules/@types/node/url.d.ts +556 -0
- package/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/node/util.d.ts +1677 -0
- package/node_modules/@types/node/v8.d.ts +980 -0
- package/node_modules/@types/node/vm.d.ts +1136 -0
- package/node_modules/@types/node/wasi.d.ts +131 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
- package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/node/web-globals/events.d.ts +106 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
- package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
- package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +671 -0
- package/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/@types/node/zlib.d.ts +589 -0
- package/node_modules/protobufjs/README.md +556 -263
- package/node_modules/protobufjs/dist/light/protobuf.js +1569 -1919
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +906 -1132
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +1576 -1993
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
- package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
- package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
- package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
- package/node_modules/protobufjs/index.d.ts +720 -834
- package/node_modules/protobufjs/package.json +44 -20
- package/node_modules/protobufjs/src/converter.js +36 -60
- package/node_modules/protobufjs/src/decoder.js +53 -124
- package/node_modules/protobufjs/src/encoder.js +2 -10
- package/node_modules/protobufjs/src/enum.js +3 -8
- package/node_modules/protobufjs/src/field.js +11 -13
- package/node_modules/protobufjs/src/index-light.js +1 -1
- package/node_modules/protobufjs/src/mapfield.js +0 -1
- package/node_modules/protobufjs/src/message.js +11 -5
- package/node_modules/protobufjs/src/method.js +4 -5
- package/node_modules/protobufjs/src/namespace.js +3 -10
- package/node_modules/protobufjs/src/object.js +20 -20
- package/node_modules/protobufjs/src/oneof.js +0 -3
- package/node_modules/protobufjs/src/parse.js +16 -78
- package/node_modules/protobufjs/src/reader.js +31 -136
- package/node_modules/protobufjs/src/reader_buffer.js +3 -24
- package/node_modules/protobufjs/src/root.js +3 -7
- package/node_modules/protobufjs/src/roots.js +1 -1
- package/node_modules/protobufjs/src/service.js +6 -13
- package/node_modules/protobufjs/src/tokenize.js +1 -6
- package/node_modules/protobufjs/src/type.js +30 -44
- package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
- package/node_modules/protobufjs/src/util/minimal.js +12 -36
- package/node_modules/protobufjs/src/util.js +17 -6
- package/node_modules/protobufjs/src/verifier.js +6 -6
- package/node_modules/protobufjs/src/wrappers.js +1 -0
- package/node_modules/protobufjs/src/writer.js +16 -42
- package/node_modules/protobufjs/src/writer_buffer.js +1 -18
- package/node_modules/protobufjs/tsconfig.json +5 -3
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +32 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +30 -0
- package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +123 -0
- package/node_modules/undici-types/connector.d.ts +36 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +30 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici-types/dispatcher.d.ts +279 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +177 -0
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +211 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +160 -0
- package/node_modules/undici-types/index.d.ts +91 -0
- package/node_modules/undici-types/interceptors.d.ts +80 -0
- package/node_modules/undici-types/mock-agent.d.ts +68 -0
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +27 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici-types/mock-pool.d.ts +27 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +29 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +41 -0
- package/node_modules/undici-types/proxy-agent.d.ts +29 -0
- package/node_modules/undici-types/readable.d.ts +68 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +347 -0
- package/node_modules/undici-types/websocket.d.ts +188 -0
- package/npm-shrinkwrap.json +95 -6
- package/package.json +4 -4
- package/skills/feishu-wiki/SKILL.md +10 -1
- package/node_modules/protobufjs/ext/README.md +0 -81
- package/node_modules/protobufjs/ext/descriptor.d.ts +0 -86
- package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -409
- package/node_modules/protobufjs/ext/descriptor.js +0 -1266
- package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
- package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -11
- package/node_modules/protobufjs/ext/textformat.js +0 -1235
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
- package/node_modules/protobufjs/src/typescript.js +0 -25
- /package/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
|
@@ -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 @@
|
|
|
1
|
+
file.txt
|
|
@@ -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,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
|
+
[](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)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var float = require(".."),
|
|
4
|
+
ieee754 = require("ieee754"),
|
|
5
|
+
newSuite = require("./suite");
|
|
6
|
+
|
|
7
|
+
var F32 = Float32Array;
|
|
8
|
+
var F64 = Float64Array;
|
|
9
|
+
delete global.Float32Array;
|
|
10
|
+
delete global.Float64Array;
|
|
11
|
+
var floatFallback = float({});
|
|
12
|
+
global.Float32Array = F32;
|
|
13
|
+
global.Float64Array = F64;
|
|
14
|
+
|
|
15
|
+
var buf = new Buffer(8);
|
|
16
|
+
|
|
17
|
+
newSuite("writeFloat")
|
|
18
|
+
.add("float", function() {
|
|
19
|
+
float.writeFloatLE(0.1, buf, 0);
|
|
20
|
+
})
|
|
21
|
+
.add("float (fallback)", function() {
|
|
22
|
+
floatFallback.writeFloatLE(0.1, buf, 0);
|
|
23
|
+
})
|
|
24
|
+
.add("ieee754", function() {
|
|
25
|
+
ieee754.write(buf, 0.1, 0, true, 23, 4);
|
|
26
|
+
})
|
|
27
|
+
.add("buffer", function() {
|
|
28
|
+
buf.writeFloatLE(0.1, 0);
|
|
29
|
+
})
|
|
30
|
+
.add("buffer (noAssert)", function() {
|
|
31
|
+
buf.writeFloatLE(0.1, 0, true);
|
|
32
|
+
})
|
|
33
|
+
.run();
|
|
34
|
+
|
|
35
|
+
newSuite("readFloat")
|
|
36
|
+
.add("float", function() {
|
|
37
|
+
float.readFloatLE(buf, 0);
|
|
38
|
+
})
|
|
39
|
+
.add("float (fallback)", function() {
|
|
40
|
+
floatFallback.readFloatLE(buf, 0);
|
|
41
|
+
})
|
|
42
|
+
.add("ieee754", function() {
|
|
43
|
+
ieee754.read(buf, 0, true, 23, 4);
|
|
44
|
+
})
|
|
45
|
+
.add("buffer", function() {
|
|
46
|
+
buf.readFloatLE(0);
|
|
47
|
+
})
|
|
48
|
+
.add("buffer (noAssert)", function() {
|
|
49
|
+
buf.readFloatLE(0, true);
|
|
50
|
+
})
|
|
51
|
+
.run();
|
|
52
|
+
|
|
53
|
+
newSuite("writeDouble")
|
|
54
|
+
.add("float", function() {
|
|
55
|
+
float.writeDoubleLE(0.1, buf, 0);
|
|
56
|
+
})
|
|
57
|
+
.add("float (fallback)", function() {
|
|
58
|
+
floatFallback.writeDoubleLE(0.1, buf, 0);
|
|
59
|
+
})
|
|
60
|
+
.add("ieee754", function() {
|
|
61
|
+
ieee754.write(buf, 0.1, 0, true, 52, 8);
|
|
62
|
+
})
|
|
63
|
+
.add("buffer", function() {
|
|
64
|
+
buf.writeDoubleLE(0.1, 0);
|
|
65
|
+
})
|
|
66
|
+
.add("buffer (noAssert)", function() {
|
|
67
|
+
buf.writeDoubleLE(0.1, 0, true);
|
|
68
|
+
})
|
|
69
|
+
.run();
|
|
70
|
+
|
|
71
|
+
newSuite("readDouble")
|
|
72
|
+
.add("float", function() {
|
|
73
|
+
float.readDoubleLE(buf, 0);
|
|
74
|
+
})
|
|
75
|
+
.add("float (fallback)", function() {
|
|
76
|
+
floatFallback.readDoubleLE(buf, 0);
|
|
77
|
+
})
|
|
78
|
+
.add("ieee754", function() {
|
|
79
|
+
ieee754.read(buf, 0, true, 52, 8);
|
|
80
|
+
})
|
|
81
|
+
.add("buffer", function() {
|
|
82
|
+
buf.readDoubleLE(0);
|
|
83
|
+
})
|
|
84
|
+
.add("buffer (noAssert)", function() {
|
|
85
|
+
buf.readDoubleLE(0, true);
|
|
86
|
+
})
|
|
87
|
+
.run();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = newSuite;
|
|
3
|
+
|
|
4
|
+
var benchmark = require("benchmark"),
|
|
5
|
+
chalk = require("chalk");
|
|
6
|
+
|
|
7
|
+
var padSize = 27;
|
|
8
|
+
|
|
9
|
+
function newSuite(name) {
|
|
10
|
+
var benches = [];
|
|
11
|
+
return new benchmark.Suite(name)
|
|
12
|
+
.on("add", function(event) {
|
|
13
|
+
benches.push(event.target);
|
|
14
|
+
})
|
|
15
|
+
.on("start", function() {
|
|
16
|
+
process.stdout.write("benchmarking " + name + " performance ...\n\n");
|
|
17
|
+
})
|
|
18
|
+
.on("cycle", function(event) {
|
|
19
|
+
process.stdout.write(String(event.target) + "\n");
|
|
20
|
+
})
|
|
21
|
+
.on("complete", function() {
|
|
22
|
+
if (benches.length > 1) {
|
|
23
|
+
var fastest = this.filter("fastest"), // eslint-disable-line no-invalid-this
|
|
24
|
+
fastestHz = getHz(fastest[0]);
|
|
25
|
+
process.stdout.write("\n" + chalk.white(pad(fastest[0].name, padSize)) + " was " + chalk.green("fastest") + "\n");
|
|
26
|
+
benches.forEach(function(bench) {
|
|
27
|
+
if (fastest.indexOf(bench) === 0)
|
|
28
|
+
return;
|
|
29
|
+
var hz = hz = getHz(bench);
|
|
30
|
+
var percent = (1 - hz / fastestHz) * 100;
|
|
31
|
+
process.stdout.write(chalk.white(pad(bench.name, padSize)) + " was " + chalk.red(percent.toFixed(1) + "% slower") + "\n");
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
process.stdout.write("\n");
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getHz(bench) {
|
|
39
|
+
return 1 / (bench.stats.mean + bench.stats.moe);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function pad(str, len, l) {
|
|
43
|
+
while (str.length < len)
|
|
44
|
+
str = l ? str + " " : " " + str;
|
|
45
|
+
return str;
|
|
46
|
+
}
|