ai 1.0.0 → 2.0.0
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/LICENSE +10 -24
- package/dist/ai-stream.d.ts +18 -0
- package/dist/ai-stream.js +132 -0
- package/dist/ai-stream.mjs +13 -0
- package/dist/anthropic-stream.d.ts +5 -0
- package/dist/anthropic-stream.js +133 -0
- package/dist/anthropic-stream.mjs +8 -0
- package/dist/chunk-265FSSO4.mjs +91 -0
- package/dist/chunk-2L3ZO4UM.mjs +45 -0
- package/dist/chunk-EZJ7FC5E.mjs +33 -0
- package/dist/chunk-JGDC3BXD.mjs +22 -0
- package/dist/chunk-NK2CVBLI.mjs +38 -0
- package/dist/chunk-PEYAHBDF.mjs +43 -0
- package/dist/chunk-TJMME6CL.mjs +24 -0
- package/dist/huggingface-stream.d.ts +5 -0
- package/dist/huggingface-stream.js +121 -0
- package/dist/huggingface-stream.mjs +8 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +278 -0
- package/dist/index.mjs +35 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.js +12 -0
- package/dist/index.test.mjs +10 -0
- package/dist/langchain-stream.d.ts +12 -0
- package/dist/langchain-stream.js +102 -0
- package/dist/langchain-stream.mjs +8 -0
- package/dist/openai-stream.d.ts +5 -0
- package/dist/openai-stream.js +144 -0
- package/dist/openai-stream.mjs +8 -0
- package/dist/streaming-text-response.d.ts +17 -0
- package/dist/streaming-text-response.js +75 -0
- package/dist/streaming-text-response.mjs +9 -0
- package/package.json +78 -29
- package/react/dist/chunk-5PP6W52J.mjs +202 -0
- package/react/dist/chunk-6EH3SWMP.mjs +55 -0
- package/react/dist/chunk-PW6HSU2N.mjs +154 -0
- package/react/dist/index.d.ts +3 -0
- package/react/dist/index.js +424 -0
- package/react/dist/index.mjs +12 -0
- package/react/dist/types-f862f74a.d.ts +123 -0
- package/react/dist/use-chat.d.ts +42 -0
- package/react/dist/use-chat.js +276 -0
- package/react/dist/use-chat.mjs +8 -0
- package/react/dist/use-completion.d.ts +47 -0
- package/react/dist/use-completion.js +229 -0
- package/react/dist/use-completion.mjs +8 -0
- package/svelte/dist/chunk-6USBQIV6.mjs +177 -0
- package/svelte/dist/chunk-BQ64GHZ3.mjs +136 -0
- package/svelte/dist/chunk-CENOSGDG.mjs +493 -0
- package/svelte/dist/index.d.ts +4 -0
- package/svelte/dist/index.js +808 -0
- package/svelte/dist/index.mjs +11 -0
- package/svelte/dist/types-f862f74a.d.ts +123 -0
- package/svelte/dist/use-chat.d.ts +39 -0
- package/svelte/dist/use-chat.js +680 -0
- package/svelte/dist/use-chat.mjs +7 -0
- package/svelte/dist/use-completion.d.ts +38 -0
- package/svelte/dist/use-completion.js +640 -0
- package/svelte/dist/use-completion.mjs +7 -0
- package/.npmignore +0 -15
- package/.travis.yml +0 -4
- package/README.md +0 -21
- package/bin/ai.js +0 -22
- package/index.js +0 -32
- package/node_modules/request/.npmignore +0 -2
- package/node_modules/request/.travis.yml +0 -12
- package/node_modules/request/CHANGELOG.md +0 -954
- package/node_modules/request/LICENSE +0 -55
- package/node_modules/request/README.md +0 -421
- package/node_modules/request/index.js +0 -166
- package/node_modules/request/lib/cookies.js +0 -40
- package/node_modules/request/lib/copy.js +0 -8
- package/node_modules/request/lib/debug.js +0 -7
- package/node_modules/request/lib/getSafe.js +0 -34
- package/node_modules/request/lib/optional.js +0 -5
- package/node_modules/request/node_modules/aws-sign2/LICENSE +0 -55
- package/node_modules/request/node_modules/aws-sign2/README.md +0 -4
- package/node_modules/request/node_modules/aws-sign2/index.js +0 -202
- package/node_modules/request/node_modules/aws-sign2/package.json +0 -47
- package/node_modules/request/node_modules/forever-agent/LICENSE +0 -55
- package/node_modules/request/node_modules/forever-agent/README.md +0 -4
- package/node_modules/request/node_modules/forever-agent/index.js +0 -119
- package/node_modules/request/node_modules/forever-agent/package.json +0 -46
- package/node_modules/request/node_modules/form-data/License +0 -19
- package/node_modules/request/node_modules/form-data/Readme.md +0 -175
- package/node_modules/request/node_modules/form-data/lib/form_data.js +0 -351
- package/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +0 -3
- package/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +0 -19
- package/node_modules/request/node_modules/form-data/node_modules/async/README.md +0 -1646
- package/node_modules/request/node_modules/form-data/node_modules/async/component.json +0 -11
- package/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +0 -1123
- package/node_modules/request/node_modules/form-data/node_modules/async/package.json +0 -60
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +0 -19
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +0 -132
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +0 -186
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +0 -2
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +0 -19
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +0 -7
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +0 -154
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +0 -99
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +0 -42
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +0 -6
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +0 -38
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +0 -21
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +0 -14
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +0 -48
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +0 -15
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +0 -18
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +0 -13
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +0 -13
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +0 -7
- package/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +0 -61
- package/node_modules/request/node_modules/form-data/node_modules/mime/LICENSE +0 -19
- package/node_modules/request/node_modules/form-data/node_modules/mime/README.md +0 -66
- package/node_modules/request/node_modules/form-data/node_modules/mime/mime.js +0 -114
- package/node_modules/request/node_modules/form-data/node_modules/mime/package.json +0 -59
- package/node_modules/request/node_modules/form-data/node_modules/mime/test.js +0 -84
- package/node_modules/request/node_modules/form-data/node_modules/mime/types/mime.types +0 -1588
- package/node_modules/request/node_modules/form-data/node_modules/mime/types/node.types +0 -77
- package/node_modules/request/node_modules/form-data/package.json +0 -80
- package/node_modules/request/node_modules/hawk/.npmignore +0 -18
- package/node_modules/request/node_modules/hawk/.travis.yml +0 -5
- package/node_modules/request/node_modules/hawk/LICENSE +0 -24
- package/node_modules/request/node_modules/hawk/Makefile +0 -10
- package/node_modules/request/node_modules/hawk/README.md +0 -625
- package/node_modules/request/node_modules/hawk/example/usage.js +0 -78
- package/node_modules/request/node_modules/hawk/images/hawk.png +0 -0
- package/node_modules/request/node_modules/hawk/images/logo.png +0 -0
- package/node_modules/request/node_modules/hawk/index.js +0 -1
- package/node_modules/request/node_modules/hawk/lib/browser.js +0 -507
- package/node_modules/request/node_modules/hawk/lib/client.js +0 -371
- package/node_modules/request/node_modules/hawk/lib/crypto.js +0 -118
- package/node_modules/request/node_modules/hawk/lib/index.js +0 -15
- package/node_modules/request/node_modules/hawk/lib/server.js +0 -523
- package/node_modules/request/node_modules/hawk/lib/utils.js +0 -183
- package/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore +0 -18
- package/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml +0 -5
- package/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE +0 -24
- package/node_modules/request/node_modules/hawk/node_modules/boom/Makefile +0 -11
- package/node_modules/request/node_modules/hawk/node_modules/boom/README.md +0 -6
- package/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png +0 -0
- package/node_modules/request/node_modules/hawk/node_modules/boom/index.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js +0 -207
- package/node_modules/request/node_modules/hawk/node_modules/boom/package.json +0 -64
- package/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js +0 -245
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore +0 -18
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml +0 -5
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE +0 -24
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile +0 -11
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md +0 -6
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js +0 -68
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json +0 -65
- package/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js +0 -101
- package/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore +0 -18
- package/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml +0 -5
- package/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE +0 -33
- package/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile +0 -10
- package/node_modules/request/node_modules/hawk/node_modules/hoek/README.md +0 -436
- package/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png +0 -0
- package/node_modules/request/node_modules/hawk/node_modules/hoek/index.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js +0 -132
- package/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js +0 -585
- package/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +0 -70
- package/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js +0 -86
- package/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js +0 -1078
- package/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore +0 -18
- package/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml +0 -5
- package/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE +0 -24
- package/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile +0 -11
- package/node_modules/request/node_modules/hawk/node_modules/sntp/README.md +0 -68
- package/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js +0 -16
- package/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js +0 -25
- package/node_modules/request/node_modules/hawk/node_modules/sntp/index.js +0 -1
- package/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js +0 -409
- package/node_modules/request/node_modules/hawk/node_modules/sntp/package.json +0 -65
- package/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js +0 -359
- package/node_modules/request/node_modules/hawk/package.json +0 -70
- package/node_modules/request/node_modules/hawk/test/browser.js +0 -817
- package/node_modules/request/node_modules/hawk/test/client.js +0 -206
- package/node_modules/request/node_modules/hawk/test/crypto.js +0 -86
- package/node_modules/request/node_modules/hawk/test/index.js +0 -316
- package/node_modules/request/node_modules/hawk/test/message.js +0 -246
- package/node_modules/request/node_modules/hawk/test/readme.js +0 -98
- package/node_modules/request/node_modules/hawk/test/server.js +0 -686
- package/node_modules/request/node_modules/hawk/test/uri.js +0 -456
- package/node_modules/request/node_modules/hawk/test/utils.js +0 -120
- package/node_modules/request/node_modules/http-signature/.dir-locals.el +0 -6
- package/node_modules/request/node_modules/http-signature/.npmignore +0 -7
- package/node_modules/request/node_modules/http-signature/LICENSE +0 -18
- package/node_modules/request/node_modules/http-signature/README.md +0 -75
- package/node_modules/request/node_modules/http-signature/http_signing.md +0 -296
- package/node_modules/request/node_modules/http-signature/lib/index.js +0 -25
- package/node_modules/request/node_modules/http-signature/lib/parser.js +0 -304
- package/node_modules/request/node_modules/http-signature/lib/signer.js +0 -179
- package/node_modules/request/node_modules/http-signature/lib/util.js +0 -249
- package/node_modules/request/node_modules/http-signature/lib/verify.js +0 -42
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore +0 -2
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE +0 -19
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md +0 -50
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js +0 -13
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js +0 -27
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js +0 -267
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js +0 -36
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js +0 -317
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js +0 -20
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +0 -63
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js +0 -172
- package/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js +0 -296
- package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md +0 -126
- package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js +0 -196
- package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json +0 -38
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG +0 -71
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE +0 -24
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/README +0 -82
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old +0 -298
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js +0 -245
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js +0 -1485
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js +0 -944
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype +0 -241
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +0 -36
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf +0 -129
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle +0 -839
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json +0 -13
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json +0 -13
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json +0 -104
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json +0 -19
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js +0 -39
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js +0 -14
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js +0 -14
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js +0 -17
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js +0 -18
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js +0 -15
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json +0 -14
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js +0 -767
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js +0 -753
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js +0 -638
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js +0 -101
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js +0 -53
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js +0 -92
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js +0 -451
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js +0 -81
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js +0 -95
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js +0 -156
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js +0 -50
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js +0 -44
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js +0 -42
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js +0 -45
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js +0 -28
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js +0 -128
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js +0 -28
- package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js +0 -31
- package/node_modules/request/node_modules/http-signature/package.json +0 -54
- package/node_modules/request/node_modules/json-stringify-safe/LICENSE +0 -27
- package/node_modules/request/node_modules/json-stringify-safe/README.md +0 -49
- package/node_modules/request/node_modules/json-stringify-safe/package.json +0 -51
- package/node_modules/request/node_modules/json-stringify-safe/stringify.js +0 -39
- package/node_modules/request/node_modules/json-stringify-safe/test.js +0 -128
- package/node_modules/request/node_modules/mime-types/.npmignore +0 -14
- package/node_modules/request/node_modules/mime-types/.travis.yml +0 -12
- package/node_modules/request/node_modules/mime-types/LICENSE +0 -22
- package/node_modules/request/node_modules/mime-types/Makefile +0 -9
- package/node_modules/request/node_modules/mime-types/README.md +0 -101
- package/node_modules/request/node_modules/mime-types/SOURCES.md +0 -17
- package/node_modules/request/node_modules/mime-types/component.json +0 -16
- package/node_modules/request/node_modules/mime-types/lib/custom.json +0 -27
- package/node_modules/request/node_modules/mime-types/lib/index.js +0 -75
- package/node_modules/request/node_modules/mime-types/lib/mime.json +0 -3317
- package/node_modules/request/node_modules/mime-types/lib/node.json +0 -55
- package/node_modules/request/node_modules/mime-types/package.json +0 -69
- package/node_modules/request/node_modules/node-uuid/.npmignore +0 -2
- package/node_modules/request/node_modules/node-uuid/LICENSE.md +0 -2
- package/node_modules/request/node_modules/node-uuid/README.md +0 -207
- package/node_modules/request/node_modules/node-uuid/benchmark/README.md +0 -53
- package/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +0 -174
- package/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +0 -34
- package/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +0 -34
- package/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +0 -84
- package/node_modules/request/node_modules/node-uuid/component.json +0 -18
- package/node_modules/request/node_modules/node-uuid/package.json +0 -54
- package/node_modules/request/node_modules/node-uuid/test/compare_v1.js +0 -63
- package/node_modules/request/node_modules/node-uuid/test/test.html +0 -17
- package/node_modules/request/node_modules/node-uuid/test/test.js +0 -228
- package/node_modules/request/node_modules/node-uuid/uuid.js +0 -245
- package/node_modules/request/node_modules/oauth-sign/LICENSE +0 -55
- package/node_modules/request/node_modules/oauth-sign/README.md +0 -4
- package/node_modules/request/node_modules/oauth-sign/index.js +0 -43
- package/node_modules/request/node_modules/oauth-sign/package.json +0 -49
- package/node_modules/request/node_modules/oauth-sign/test.js +0 -49
- package/node_modules/request/node_modules/qs/.jshintignore +0 -1
- package/node_modules/request/node_modules/qs/.jshintrc +0 -10
- package/node_modules/request/node_modules/qs/.npmignore +0 -18
- package/node_modules/request/node_modules/qs/.travis.yml +0 -4
- package/node_modules/request/node_modules/qs/LICENSE +0 -28
- package/node_modules/request/node_modules/qs/Makefile +0 -8
- package/node_modules/request/node_modules/qs/Readme.md +0 -120
- package/node_modules/request/node_modules/qs/index.js +0 -1
- package/node_modules/request/node_modules/qs/lib/index.js +0 -15
- package/node_modules/request/node_modules/qs/lib/parse.js +0 -151
- package/node_modules/request/node_modules/qs/lib/stringify.js +0 -52
- package/node_modules/request/node_modules/qs/lib/utils.js +0 -131
- package/node_modules/request/node_modules/qs/package.json +0 -61
- package/node_modules/request/node_modules/qs/test/parse.js +0 -236
- package/node_modules/request/node_modules/qs/test/stringify.js +0 -123
- package/node_modules/request/node_modules/stringstream/.npmignore +0 -15
- package/node_modules/request/node_modules/stringstream/.travis.yml +0 -4
- package/node_modules/request/node_modules/stringstream/LICENSE.txt +0 -4
- package/node_modules/request/node_modules/stringstream/README.md +0 -38
- package/node_modules/request/node_modules/stringstream/example.js +0 -27
- package/node_modules/request/node_modules/stringstream/package.json +0 -48
- package/node_modules/request/node_modules/stringstream/stringstream.js +0 -102
- package/node_modules/request/node_modules/tough-cookie/.jshintrc +0 -70
- package/node_modules/request/node_modules/tough-cookie/.npmignore +0 -3
- package/node_modules/request/node_modules/tough-cookie/.travis.yml +0 -8
- package/node_modules/request/node_modules/tough-cookie/LICENSE +0 -78
- package/node_modules/request/node_modules/tough-cookie/README.md +0 -412
- package/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +0 -239
- package/node_modules/request/node_modules/tough-cookie/lib/cookie.js +0 -1107
- package/node_modules/request/node_modules/tough-cookie/lib/memstore.js +0 -123
- package/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +0 -69
- package/node_modules/request/node_modules/tough-cookie/lib/store.js +0 -37
- package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/LICENSE-MIT.txt +0 -20
- package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/README.md +0 -176
- package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/package.json +0 -87
- package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/punycode.js +0 -528
- package/node_modules/request/node_modules/tough-cookie/package.json +0 -67
- package/node_modules/request/node_modules/tough-cookie/public-suffix.txt +0 -5229
- package/node_modules/request/node_modules/tough-cookie/test.js +0 -1625
- package/node_modules/request/node_modules/tunnel-agent/.jshintrc +0 -5
- package/node_modules/request/node_modules/tunnel-agent/LICENSE +0 -55
- package/node_modules/request/node_modules/tunnel-agent/README.md +0 -4
- package/node_modules/request/node_modules/tunnel-agent/index.js +0 -236
- package/node_modules/request/node_modules/tunnel-agent/package.json +0 -46
- package/node_modules/request/package.json +0 -77
- package/node_modules/request/request.js +0 -1428
- package/test/fixtures/github-response.json +0 -1367
- package/test/index.js +0 -55
@@ -1,196 +0,0 @@
|
|
1
|
-
// Copyright (c) 2012, Mark Cavage. All rights reserved.
|
2
|
-
|
3
|
-
var assert = require('assert');
|
4
|
-
var Stream = require('stream').Stream;
|
5
|
-
var util = require('util');
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
///--- Globals
|
10
|
-
|
11
|
-
var NDEBUG = process.env.NODE_NDEBUG || false;
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
///--- Messages
|
16
|
-
|
17
|
-
var ARRAY_TYPE_REQUIRED = '%s ([%s]) required';
|
18
|
-
var TYPE_REQUIRED = '%s (%s) is required';
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
///--- Internal
|
23
|
-
|
24
|
-
function capitalize(str) {
|
25
|
-
return (str.charAt(0).toUpperCase() + str.slice(1));
|
26
|
-
}
|
27
|
-
|
28
|
-
function uncapitalize(str) {
|
29
|
-
return (str.charAt(0).toLowerCase() + str.slice(1));
|
30
|
-
}
|
31
|
-
|
32
|
-
function _() {
|
33
|
-
return (util.format.apply(util, arguments));
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
function _assert(arg, type, name, stackFunc) {
|
38
|
-
if (!NDEBUG) {
|
39
|
-
name = name || type;
|
40
|
-
stackFunc = stackFunc || _assert.caller;
|
41
|
-
var t = typeof (arg);
|
42
|
-
|
43
|
-
if (t !== type) {
|
44
|
-
throw new assert.AssertionError({
|
45
|
-
message: _(TYPE_REQUIRED, name, type),
|
46
|
-
actual: t,
|
47
|
-
expected: type,
|
48
|
-
operator: '===',
|
49
|
-
stackStartFunction: stackFunc
|
50
|
-
});
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
///--- API
|
58
|
-
|
59
|
-
function array(arr, type, name) {
|
60
|
-
if (!NDEBUG) {
|
61
|
-
name = name || type;
|
62
|
-
|
63
|
-
if (!Array.isArray(arr)) {
|
64
|
-
throw new assert.AssertionError({
|
65
|
-
message: _(ARRAY_TYPE_REQUIRED, name, type),
|
66
|
-
actual: typeof (arr),
|
67
|
-
expected: 'array',
|
68
|
-
operator: 'Array.isArray',
|
69
|
-
stackStartFunction: array.caller
|
70
|
-
});
|
71
|
-
}
|
72
|
-
|
73
|
-
for (var i = 0; i < arr.length; i++) {
|
74
|
-
_assert(arr[i], type, name, array);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
function bool(arg, name) {
|
81
|
-
_assert(arg, 'boolean', name, bool);
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
function buffer(arg, name) {
|
86
|
-
if (!Buffer.isBuffer(arg)) {
|
87
|
-
throw new assert.AssertionError({
|
88
|
-
message: _(TYPE_REQUIRED, name, type),
|
89
|
-
actual: typeof (arg),
|
90
|
-
expected: 'buffer',
|
91
|
-
operator: 'Buffer.isBuffer',
|
92
|
-
stackStartFunction: buffer
|
93
|
-
});
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
|
98
|
-
function func(arg, name) {
|
99
|
-
_assert(arg, 'function', name);
|
100
|
-
}
|
101
|
-
|
102
|
-
|
103
|
-
function number(arg, name) {
|
104
|
-
_assert(arg, 'number', name);
|
105
|
-
}
|
106
|
-
|
107
|
-
|
108
|
-
function object(arg, name) {
|
109
|
-
_assert(arg, 'object', name);
|
110
|
-
}
|
111
|
-
|
112
|
-
|
113
|
-
function stream(arg, name) {
|
114
|
-
if (!(arg instanceof Stream)) {
|
115
|
-
throw new assert.AssertionError({
|
116
|
-
message: _(TYPE_REQUIRED, name, type),
|
117
|
-
actual: typeof (arg),
|
118
|
-
expected: 'Stream',
|
119
|
-
operator: 'instanceof',
|
120
|
-
stackStartFunction: buffer
|
121
|
-
});
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
|
126
|
-
function string(arg, name) {
|
127
|
-
_assert(arg, 'string', name);
|
128
|
-
}
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
///--- Exports
|
133
|
-
|
134
|
-
module.exports = {
|
135
|
-
bool: bool,
|
136
|
-
buffer: buffer,
|
137
|
-
func: func,
|
138
|
-
number: number,
|
139
|
-
object: object,
|
140
|
-
stream: stream,
|
141
|
-
string: string
|
142
|
-
};
|
143
|
-
|
144
|
-
|
145
|
-
Object.keys(module.exports).forEach(function (k) {
|
146
|
-
if (k === 'buffer')
|
147
|
-
return;
|
148
|
-
|
149
|
-
var name = 'arrayOf' + capitalize(k);
|
150
|
-
|
151
|
-
if (k === 'bool')
|
152
|
-
k = 'boolean';
|
153
|
-
if (k === 'func')
|
154
|
-
k = 'function';
|
155
|
-
module.exports[name] = function (arg, name) {
|
156
|
-
array(arg, k, name);
|
157
|
-
};
|
158
|
-
});
|
159
|
-
|
160
|
-
Object.keys(module.exports).forEach(function (k) {
|
161
|
-
var _name = 'optional' + capitalize(k);
|
162
|
-
var s = uncapitalize(k.replace('arrayOf', ''));
|
163
|
-
if (s === 'bool')
|
164
|
-
s = 'boolean';
|
165
|
-
if (s === 'func')
|
166
|
-
s = 'function';
|
167
|
-
|
168
|
-
if (k.indexOf('arrayOf') !== -1) {
|
169
|
-
module.exports[_name] = function (arg, name) {
|
170
|
-
if (!NDEBUG && arg !== undefined) {
|
171
|
-
array(arg, s, name);
|
172
|
-
}
|
173
|
-
};
|
174
|
-
} else {
|
175
|
-
module.exports[_name] = function (arg, name) {
|
176
|
-
if (!NDEBUG && arg !== undefined) {
|
177
|
-
_assert(arg, s, name);
|
178
|
-
}
|
179
|
-
};
|
180
|
-
}
|
181
|
-
});
|
182
|
-
|
183
|
-
|
184
|
-
// Reexport built-in assertions
|
185
|
-
Object.keys(assert).forEach(function (k) {
|
186
|
-
if (k === 'AssertionError') {
|
187
|
-
module.exports[k] = assert[k];
|
188
|
-
return;
|
189
|
-
}
|
190
|
-
|
191
|
-
module.exports[k] = function () {
|
192
|
-
if (!NDEBUG) {
|
193
|
-
assert[k].apply(assert[k], arguments);
|
194
|
-
}
|
195
|
-
};
|
196
|
-
});
|
package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"author": {
|
3
|
-
"name": "Mark Cavage",
|
4
|
-
"email": "mcavage@gmail.com"
|
5
|
-
},
|
6
|
-
"name": "assert-plus",
|
7
|
-
"description": "Extra assertions on top of node's assert module",
|
8
|
-
"version": "0.1.2",
|
9
|
-
"main": "./assert.js",
|
10
|
-
"dependencies": {},
|
11
|
-
"devDependencies": {},
|
12
|
-
"optionalDependencies": {},
|
13
|
-
"engines": {
|
14
|
-
"node": ">=0.6"
|
15
|
-
},
|
16
|
-
"readme": "# node-assert-plus\n\nThis library is a super small wrapper over node's assert module that has two\nthings: (1) the ability to disable assertions with the environment variable\nNODE_NDEBUG, and (2) some API wrappers for argument testing. Like\n`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks\nlike this:\n\n var assert = require('assert-plus');\n\n function fooAccount(options, callback) {\n\t assert.object(options, 'options');\n\t\tassert.number(options.id, 'options.id);\n\t\tassert.bool(options.isManager, 'options.isManager');\n\t\tassert.string(options.name, 'options.name');\n\t\tassert.arrayOfString(options.email, 'options.email');\n\t\tassert.func(callback, 'callback');\n\n // Do stuff\n\t\tcallback(null, {});\n }\n\n# API\n\nAll methods that *aren't* part of node's core assert API are simply assumed to\ntake an argument, and then a string 'name' that's not a message; `AssertionError`\nwill be thrown if the assertion fails with a message like:\n\n AssertionError: foo (string) is required\n\tat test (/home/mark/work/foo/foo.js:3:9)\n\tat Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)\n\tat Module._compile (module.js:446:26)\n\tat Object..js (module.js:464:10)\n\tat Module.load (module.js:353:31)\n\tat Function._load (module.js:311:12)\n\tat Array.0 (module.js:484:10)\n\tat EventEmitter._tickCallback (node.js:190:38)\n\nfrom:\n\n function test(foo) {\n\t assert.string(foo, 'foo');\n }\n\nThere you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:\n\n function test(foo) {\n\t assert.arrayOfString(foo, 'foo');\n }\n\nYou can assert IFF an argument is not `undefined` (i.e., an optional arg):\n\n assert.optionalString(foo, 'foo');\n\nLastly, you can opt-out of assertion checking altogether by setting the\nenvironment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have\nlots of assertions, and don't want to pay `typeof ()` taxes to v8 in\nproduction.\n\nThe complete list of APIs is:\n\n* assert.bool\n* assert.buffer\n* assert.func\n* assert.number\n* assert.object\n* assert.string\n* assert.arrayOfBool\n* assert.arrayOfFunc\n* assert.arrayOfNumber\n* assert.arrayOfObject\n* assert.arrayOfString\n* assert.optionalBool\n* assert.optionalBuffer\n* assert.optionalFunc\n* assert.optionalNumber\n* assert.optionalObject\n* assert.optionalString\n* assert.optionalArrayOfBool\n* assert.optionalArrayOfFunc\n* assert.optionalArrayOfNumber\n* assert.optionalArrayOfObject\n* assert.optionalArrayOfString\n* assert.AssertionError\n* assert.fail\n* assert.ok\n* assert.equal\n* assert.notEqual\n* assert.deepEqual\n* assert.notDeepEqual\n* assert.strictEqual\n* assert.notStrictEqual\n* assert.throws\n* assert.doesNotThrow\n* assert.ifError\n\n# Installation\n\n npm install assert-plus\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2012 Mark Cavage\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-assert-plus/issues>.\n",
|
17
|
-
"_id": "assert-plus@0.1.2",
|
18
|
-
"dist": {
|
19
|
-
"shasum": "d93ffdbb67ac5507779be316a7d65146417beef8",
|
20
|
-
"tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz"
|
21
|
-
},
|
22
|
-
"_npmVersion": "1.1.59",
|
23
|
-
"_npmUser": {
|
24
|
-
"name": "mcavage",
|
25
|
-
"email": "mcavage@gmail.com"
|
26
|
-
},
|
27
|
-
"maintainers": [
|
28
|
-
{
|
29
|
-
"name": "mcavage",
|
30
|
-
"email": "mcavage@gmail.com"
|
31
|
-
}
|
32
|
-
],
|
33
|
-
"directories": {},
|
34
|
-
"_shasum": "d93ffdbb67ac5507779be316a7d65146417beef8",
|
35
|
-
"_from": "assert-plus@0.1.2",
|
36
|
-
"_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz",
|
37
|
-
"scripts": {}
|
38
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
This contains tickets fixed in each version release in reverse chronological
|
2
|
-
order. There is one ticket per line. Each commits message has the tickets fixed
|
3
|
-
in it. The commit message also has the corresponding github issue. i.e. CTYPE-42
|
4
|
-
would be issue 42. Each issue can be found at:
|
5
|
-
https://github.com/rmustacc/node-ctype/issues/%d.
|
6
|
-
|
7
|
-
CTYPE v0.5.2
|
8
|
-
CTYPE-46 Release 0.5.2
|
9
|
-
CTYPE-45 error in setEndian logic
|
10
|
-
|
11
|
-
v0.5.1
|
12
|
-
CTYPE-44 Release 0.5.1
|
13
|
-
Contributed by Terin Stock:
|
14
|
-
CTYPE-41 CTypeParser.writeStruct should return its offset
|
15
|
-
Contributed by Terin Stock:
|
16
|
-
CTYPE-42 int64_t returns wrong size
|
17
|
-
|
18
|
-
v0.5.0
|
19
|
-
CTYPE-40 Release 0.5.0
|
20
|
-
CTYPE-39 want > 0.6 engine support
|
21
|
-
|
22
|
-
v0.4.0
|
23
|
-
CTYPE-37 Release v0.4.0
|
24
|
-
CTYPE-6 want additional entry point for write
|
25
|
-
CTYPE-20 Add 64-bit int support into core parser
|
26
|
-
CTYPE-31 Fix bounds errors node/2129
|
27
|
-
CTYPE-33 Update copyright holders
|
28
|
-
CTYPE-34 ctf.js confuses sign bit.
|
29
|
-
CTYPE-35 Make the README more useful for getting started
|
30
|
-
CTYPE-36 want manual page on ctio functions
|
31
|
-
|
32
|
-
v0.3.1
|
33
|
-
CTYPE-29 Release 0.3.1
|
34
|
-
CTYPE-28 Want v0.6 npm support
|
35
|
-
|
36
|
-
v0.3.0
|
37
|
-
CTYPE-27 Release v0.3.0
|
38
|
-
CTYPE-26 Want alternate default char behavior
|
39
|
-
|
40
|
-
v0.2.1
|
41
|
-
CTYPE-25 Release v0.2.1
|
42
|
-
CTYPE-24 Writing structs is busted
|
43
|
-
|
44
|
-
v0.2.0:
|
45
|
-
CTYPE-23 Release v0.2.0
|
46
|
-
CTYPE-21 Add support for CTF JSON data
|
47
|
-
CTYPE-22 Add Javascriptlint profile
|
48
|
-
CTYPE-15 Pull in ctio updates from node/master
|
49
|
-
|
50
|
-
v0.1.0:
|
51
|
-
CTYPE-18 Bump version to v0.1.0
|
52
|
-
CTYPE-17 Fix nested structures
|
53
|
-
CTYPE-16 Remove extraneous logging
|
54
|
-
CTYPE-14 toAbs64 and toApprox64 are not exported
|
55
|
-
|
56
|
-
v0.0.3:
|
57
|
-
CTYPE-12 Bump version to v0.0.3
|
58
|
-
CTYPE-11 fix typo in wuint64
|
59
|
-
CTYPE-10 Integrate jsstyle
|
60
|
-
|
61
|
-
v0.0.2:
|
62
|
-
CTYPE-8 dump npm version to v0.0.2
|
63
|
-
CTYPE-9 want changelog
|
64
|
-
CTYPE-7 fix typo in detypes.
|
65
|
-
|
66
|
-
v0.0.1:
|
67
|
-
CTYPE-5 Missing from NPM registry
|
68
|
-
CTYPE-4 int16_t calls wrong read function
|
69
|
-
CTYPE-3 API example types are missing quotes as strings
|
70
|
-
CTYPE-2 doc missing 64-bit functions
|
71
|
-
CTYPE-1 Need license
|
@@ -1,24 +0,0 @@
|
|
1
|
-
The following license applies to all files unless the file is specified below.
|
2
|
-
Each file specified below has its license information embedded in it:
|
3
|
-
|
4
|
-
tools/jsstyle
|
5
|
-
|
6
|
-
Copyright 2011, Robert Mustacchi. All rights reserved.
|
7
|
-
Copyright 2011, Joyent, Inc. All rights reserved.
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
-
of this software and associated documentation files (the "Software"), to
|
10
|
-
deal in the Software without restriction, including without limitation the
|
11
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
12
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
13
|
-
furnished to do so, subject to the following conditions:
|
14
|
-
|
15
|
-
The above copyright notice and this permission notice shall be included in
|
16
|
-
all copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
23
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
24
|
-
IN THE SOFTWARE.
|
@@ -1,82 +0,0 @@
|
|
1
|
-
Node-CType is a way to read and write binary data in structured and easy to use
|
2
|
-
format. Its name comes from the C header file.
|
3
|
-
|
4
|
-
To get started, simply clone the repository or use npm to install it. Once it is
|
5
|
-
there, simply require it.
|
6
|
-
|
7
|
-
git clone git://github.com/rmustacc/node-ctype
|
8
|
-
npm install ctype
|
9
|
-
var mod_ctype = require('ctype')
|
10
|
-
|
11
|
-
|
12
|
-
There are two APIs that you can use, depending on what abstraction you'd like.
|
13
|
-
The low level API let's you read and write individual integers and floats from
|
14
|
-
buffers. The higher level API let's you read and write structures of these. To
|
15
|
-
illustrate this, let's looks look at how we would read and write a binary
|
16
|
-
encoded x,y point.
|
17
|
-
|
18
|
-
In C we would define this structure as follows:
|
19
|
-
|
20
|
-
typedef struct point {
|
21
|
-
uint16_t p_x;
|
22
|
-
uint16_t p_y;
|
23
|
-
} point_t;
|
24
|
-
|
25
|
-
To read a binary encoded point from a Buffer, we first need to create a CType
|
26
|
-
parser (where we specify the endian and other options) and add the typedef.
|
27
|
-
|
28
|
-
var parser = new mod_ctype.Parser({ endian: 'big' });
|
29
|
-
parser.typedef('point_t', [
|
30
|
-
{ x: { type: 'uint16_t' } },
|
31
|
-
{ y: { type: 'uint16_t' } }
|
32
|
-
]);
|
33
|
-
|
34
|
-
From here, given a buffer buf and an offset into it, we can read a point.
|
35
|
-
|
36
|
-
var out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);
|
37
|
-
console.log(out);
|
38
|
-
{ point: { x: 23, y: 42 } }
|
39
|
-
|
40
|
-
Another way to get the same information would be to use the low level methods.
|
41
|
-
Note that these require you to manually deal with the offset. Here's how we'd
|
42
|
-
get the same values of x and y from the buffer.
|
43
|
-
|
44
|
-
var x = mod_ctype.ruint16(buf, 'big', 0);
|
45
|
-
var y = mod_ctype.ruint16(buf, 'big', 2);
|
46
|
-
console.log(x + ', ' + y);
|
47
|
-
23, 42
|
48
|
-
|
49
|
-
The true power of this API comes from the ability to define and nest typedefs,
|
50
|
-
just as you would in C. By default, the following types are defined by default.
|
51
|
-
Note that they return a Number, unless indicated otherwise.
|
52
|
-
|
53
|
-
* int8_t
|
54
|
-
* int16_t
|
55
|
-
* int32_t
|
56
|
-
* int64_t (returns an array where val[0] << 32 + val[1] would be the value)
|
57
|
-
* uint8_t
|
58
|
-
* uint16_t
|
59
|
-
* uint32_t
|
60
|
-
* uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
|
61
|
-
* float
|
62
|
-
* double
|
63
|
-
* char (either returns a buffer with that character or a uint8_t)
|
64
|
-
* char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
|
65
|
-
|
66
|
-
|
67
|
-
ctf2json integration:
|
68
|
-
|
69
|
-
Node-CType supports consuming the output of ctf2json. Once you read in a JSON file,
|
70
|
-
all you have to do to add all the definitions it contains is:
|
71
|
-
|
72
|
-
var data, parser;
|
73
|
-
data = JSON.parse(parsedJSONData);
|
74
|
-
parser = mod_ctype.parseCTF(data, { endian: 'big' });
|
75
|
-
|
76
|
-
For more documentation, see the file README.old. Full documentation is in the
|
77
|
-
process of being rewritten as a series of manual pages which will be available
|
78
|
-
in the repository and online for viewing.
|
79
|
-
|
80
|
-
To read the ctio manual page simple run, from the root of the workspace:
|
81
|
-
|
82
|
-
man -Mman -s 3ctype ctio
|