Cannot read local file (under node) ?
See original GitHub issueI’m trying to do a very basic thing, opening a file :
cat index.js
const jsroot = require("jsroot");
console.log("JSROOT version", jsroot.version);
jsroot
//.openFile("https://root.cern.ch/js/files/hsimple.root") // WORKS
.openFile("file://hsimple.root") // DOES NOT WORK
.then((file) => console.log(file))
.catch((err) => console.log("boum",err));
node index.js
works if the file is remote but for the local case I get :
JSROOT version 6.0.0 14/01/2021
boum ReferenceError: filename is not defined
at /Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.io.js:2435:23
at new Promise (<anonymous>)
at TNodejsFile._open (/Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.io.js:2434:14)
at Object.JSROOT.openFile (/Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.io.js:3113:19)
at /Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.core.js:1340:53
at processTicksAndRejections (internal/process/task_queues.js:93:5)
what am I missing 😉 ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Can't load local files when using NodeJS server - Stack Overflow
A web server in node.js does not serve ANY files by default (unlike some other web servers). So, if you want js files...
Read more >How do I read files in Node.js?
The easiest way to read the entire contents of a file is with fs. ... try to read an invalid file - the...
Read more >How to work with files on Databricks
You can work with files on DBFS, the local driver node of the cluster, cloud object storage, external locations, and in Databricks Repos....
Read more >Explain about Read and Write of a file using JavaScript
Let's demonstrate some examples of reading and writing files with the node.js fs module. The fs.readFile() and rs.writeFile() methods are used ...
Read more >How to read and write files in Node.js
The simplest way to read a file in Node.js is to use the fs.readFile() method by passing the file path, encoding, and a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It is published now in https://github.com/root-project/jsroot/releases/tag/6.0.1 release
I will provide 6.0.1 tag today or tomorrow. Next 6.1 version with
TRatioPlot
support will be released in next 2-3 weeks.