forked from jspsych/jsPsych
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beginning CLI tool and able to read files at a path
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# jsPsych "metadata" experimen | ||
|
||
What does metadata do and what is the importance of it | ||
|
||
## Choose your own (setup) adventure | ||
|
||
Starting with the release of version 7.0 of jsPsych there are three different ways that you can add jsPsych to your project. | ||
Which approach you choose will depend on what your goals are.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
import JsPsychMetadata from "../dist/index.js"; | ||
|
||
const metadata = new JsPsychMetadata(); | ||
const directoryPath = process.cwd() + "/test"; // can make this the path that is given (relative) | ||
console.log(directoryPath); | ||
|
||
fs.readdir(directoryPath, (err, files) => { | ||
if (err) { | ||
console.error("Error reading directory:", err); | ||
return; | ||
} | ||
|
||
files.forEach((file) => { | ||
const filePath = path.join(directoryPath, file); | ||
|
||
// Read each file asynchronously | ||
fs.readFile(filePath, "utf8", (err, data) => { | ||
if (err) { | ||
console.error(`Error reading file ${file}:`, err); | ||
return; | ||
} | ||
console.log(`Contents of ${file}:`); | ||
console.log(data); // Output the contents of the file | ||
}); | ||
}); | ||
}); | ||
|
||
// console.log("metadata:", metadata.getMetadata()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import JsPsychMetadata from '../dist/index.js'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
const metadata = new JsPsychMetadata(); | ||
|
||
const directoryPath = './test'; | ||
|
||
fs.readdir(directoryPath, (err, files) => { | ||
if (err) { | ||
console.error('Error reading directory:', err); | ||
return; | ||
} | ||
|
||
console.log(`Files in ${directoryPath}:`); | ||
files.forEach(file => { | ||
console.log(file); | ||
}); | ||
}); | ||
|
||
|
||
console.log("metadata:", metadata.getMetadata()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# jsPsych "metadata" experimen | ||
|
||
What does metadata do and what is the importance of it | ||
|
||
## Choose your own (setup) adventure | ||
|
||
Starting with the release of version 7.0 of jsPsych there are three different ways that you can add jsPsych to your project. | ||
Which approach you choose will depend on what your goals are.t |