-1
フォルダ、jsonファイル、およびその内容を含むフォルダ構造をJSONオブジェクトのようなツリービューにマップしたいと考えています。私は/フォルダ構造をツリービューにロードするNodeJSのJSONオブジェクト
...誰もが次のフォルダ構造をロードする機能、すなわちloadFolder(「/ A」)を私に提供するかどうか尋ねるために
/a/file1.jsonが欲しいです
:/a/file2.json
/a/b/file1.json
/A/B/C
が...このJSONオブジェクトにつながります
{
path: "/a",
name: "a",
type: "folder",
subnodes: [
{
path: "https://stackoverflow.com/a/file1.json",
name: "file1.json",
type: "file",
content: {
// file content here
}
},
{
path: "https://stackoverflow.com/a/file2.json",
name: "file2.json",
type: "file",
content: {
// file content here
}
},
{
path: "https://stackoverflow.com/a/b",
name: "b",
type: "folder",
subnodes: [
{
path: "https://stackoverflow.com/a/b/file1.json",
name: "file1.json",
type: "file",
content: {
// file content here
}
},
{
path: "https://stackoverflow.com/a/b/c",
name: "c",
type: "folder",
subnodes: []
}
]
}
]
}