-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Showing
4 changed files
with
42 additions
and
1 deletion.
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
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 @@ | ||
scrollDiskParser | ||
extends scrollTableParser | ||
description Output file into as table. | ||
crux disk | ||
javascript | ||
delimiter = "json" | ||
get delimitedData() { | ||
return this.isNodeJs() ? this.delimitedDataNodeJs : "" | ||
} | ||
get delimitedDataNodeJs() { | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const {folderPath} = this.parent.file | ||
const folder = this.content ? path.join(folderPath, this.content) : folderPath | ||
function getDirectoryContents(dirPath) { | ||
const directoryContents = []; | ||
const items = fs.readdirSync(dirPath); | ||
items.forEach((item) => { | ||
const itemPath = path.join(dirPath, item); | ||
const stats = fs.statSync(itemPath); | ||
directoryContents.push({ | ||
name: item, | ||
type: stats.isDirectory() ? 'directory' : 'file', | ||
size: stats.size, | ||
lastModified: stats.mtime | ||
}); | ||
}); | ||
return directoryContents; | ||
} | ||
return JSON.stringify(getDirectoryContents(folder)) | ||
} |
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
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,7 @@ | ||
buildHtml | ||
title Disk | ||
theme gazette | ||
container | ||
disk | ||
printTable | ||
tableSearch |