-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f907a4b
commit 729f973
Showing
1 changed file
with
11 additions
and
6 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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
#!/usr/bin/env node | ||
console.log("Hola amigos"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { draw } = require("memory-viz"); | ||
|
||
// args[1] is the path to the JSON file (display error for when the path is not valid) | ||
// how to run the file? | ||
// convert JSON to JS (JSON.parse) | ||
// run memoryviz on the output object (error checking for invalid JSON) | ||
// save the generated svg | ||
const filePath = process.argv[2]; | ||
const absolutePath = path.resolve(filePath); | ||
const fileContent = fs.readFileSync(absolutePath, "utf8"); | ||
const data = JSON.parse(fileContent); | ||
|
||
const m = draw(data, true, { width: 1300 }); | ||
|
||
m.save("my_demo.svg"); |