CDXJReader.createReadStream is not a function
Closed this issue · 4 comments
machawk1 commented
I cannot get this to run using the examples. Below is a transcript of the test. Please let me know if there is something more I should test, @N0taN3rd, as I foresee this library being useful.
$ pwd
/Users/machawk1/Downloads
$ node --version
v7.4.0
$ npm install --upgrade cdxj
/Users/machawk1
└── cdxj@1.0.0
$ cat sample.cdxj
edu,odu,cs)/~salam 20160305192247 {"locator": "urn:ipfs/QmeVWGtnfuJ1QnpmtKKnyArVgEpq7v31kktEfh6c8mDiXE/QmZWKQRBNXNrVZ69LoGpMNJi5NU66gDhnGtQukWJepv7Kr", "encryption_method": "xor", "encryption_key": "radon", "mime_type": "text/html", "status_code": "200"}
$ cat node-cdxj-test.js
const CDXJReader = require('cdxj')
const cdxjStream = CDXJReader.createReadStream('/Users/machawk1/Downloads/sample.cdxj')
cdxjStream.on('data', cdxjEntry => {
console.log(cdxjEntry)
})
$ node node-cdxj-test.js
/Users/machawk1/Downloads/node-cdxj-test.js:3
const cdxjStream = CDXJReader.createReadStream('/Users/machawk1/Downloads/sample.cdxj')
^
TypeError: CDXJReader.createReadStream is not a function
at Object.<anonymous> (/Users/machawk1/Downloads/node-cdxj-test.js:3:31)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
N0taN3rd commented
@machawk1 can you run npm update or change the dependence in the package.json to 1.0.1
I forgot to publish the latest version to npm and just did
N0taN3rd commented
@machawk1 also let me know if you do not require the "--harmony" node arg as I use "static" modifier in the class
node file.js
vs
node --harmony file.js
machawk1 commented
@N0taN3rd I performed npm install --upgrade cdxj
to grab version 1.0.1 and re-ran the script. The results are different but look more like success than before.
$ node node-cdxj-test.js
CDXJEntry {
_surtb: <Buffer 65 64 75 2c 6f 64 75 2c 63 73 29 2f 7e 73 61 6c 61 6d>,
_surt: null,
_surtDidConvert: false,
_dtb: <Buffer 32 30 31 36 30 33 30 35 31 39 32 32 34 37>,
_dt: null,
_dtDidConvert: false,
_jsonb: <Buffer 7b 22 6c 6f 63 61 74 6f 72 22 3a 20 22 75 72 6e 3a 69 70 66 73 2f 51 6d 65 56 57 47 74 6e 66 75 4a 31 51 6e 70 6d 74 4b 4b 6e 79 41 72 56 67 45 70 71 ... >,
_json: null,
_jsonDidConvert: false }
If this is the intended output, feel free to close this ticket.