Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ This repository contains solutions for Node.js Fundamentals assignment. The assi
- `npm run fs:restore` - Restore directory structure from snapshot
- `npm run fs:findByExt` - Find files by extension in workspace
- `npm run fs:merge` - Merge .txt files from workspace/parts
- `npm run fs:merge -- --files a.txt,b.txt,c.txt` - Merge specific files from workspace/parts in provided order

Snapshot format reminder:

```json
{
"rootPath": "/absolute/path/to/workspace",
"entries": [
{ "path": "file1.txt", "type": "file", "size": 1024, "content": "base64" },
{ "path": "nested", "type": "directory" }
]
}
```

`entries[].path` values must be relative to `workspace`.

### CLI (src/cli)

Expand Down
3 changes: 2 additions & 1 deletion src/fs/merge.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const merge = async () => {
// Write your code here
// Read all .txt files from workspace/parts in alphabetical order
// Default: read all .txt files from workspace/parts in alphabetical order
// Optional: support --files filename1,filename2,... to merge specific files in provided order
// Concatenate content and write to workspace/merged.txt
};

Expand Down
1 change: 1 addition & 0 deletions src/fs/restore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const restore = async () => {
// Write your code here
// Read snapshot.json
// Treat snapshot.rootPath as metadata only
// Recreate directory/file structure in workspace_restored
};

Expand Down
4 changes: 3 additions & 1 deletion src/fs/snapshot.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const snapshot = async () => {
// Write your code here
// Recursively scan workspace directory
// Write snapshot.json with flat array of all entries
// Write snapshot.json with:
// - rootPath: absolute path to workspace
// - entries: flat array of relative paths and metadata
};

await snapshot();