{"id":25980063,"url":"https://github.com/svetozarmateev/fs-assistant","last_synced_at":"2025-03-05T07:26:06.740Z","repository":{"id":33566930,"uuid":"158840805","full_name":"SvetozarMateev/fs-assistant","owner":"SvetozarMateev","description":"fs-assistant npm package","archived":false,"fork":false,"pushed_at":"2024-02-25T13:01:36.000Z","size":214,"stargazers_count":3,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T05:04:31.164Z","etag":null,"topics":["fs","javascript-library","nodejs","npm","npm-package","recursive","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SvetozarMateev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-23T14:09:29.000Z","updated_at":"2024-02-25T12:56:43.000Z","dependencies_parsed_at":"2024-06-21T20:18:33.122Z","dependency_job_id":"cd84283f-7b02-4fe8-9318-f921ddcde85e","html_url":"https://github.com/SvetozarMateev/fs-assistant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvetozarMateev%2Ffs-assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvetozarMateev%2Ffs-assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvetozarMateev%2Ffs-assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SvetozarMateev%2Ffs-assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SvetozarMateev","download_url":"https://codeload.github.com/SvetozarMateev/fs-assistant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241985146,"owners_count":20053034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fs","javascript-library","nodejs","npm","npm-package","recursive","typescript","typescript-library"],"created_at":"2025-03-05T07:26:05.957Z","updated_at":"2025-03-05T07:26:06.735Z","avatar_url":"https://github.com/SvetozarMateev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fs-assistant\n\n![](https://badgen.net/npm/v/fs-assistant)\n![](https://img.shields.io/bundlephobia/min/fs-assistant.svg)\n![](https://img.shields.io/npm/types/fs-assistant.svg)\n![](https://img.shields.io/npm/l/fs-assistant.svg)\n![](https://img.shields.io/npm/dt/fs-assistant.svg)\n\n\nfs-assistant is a simple library that gives you recursive folder copying, simplified file overrides and promisified fs functions.\n\n```javascript\nreplaceStringInFile (pathToFile: string, stringPattern: RegExp | string, newString: string) =\u003e Promise\u003cvoid\u003e\n```\nReplaces a string in a file that matches the pattern with the new given string.\n\n```javascript\ncopyDir (pathToDir: string, pathToNewDir: string) =\u003e Promise\u003cvoid\u003e\n```\nRecursively copies all files from a directory to another.\n\n```javascript\nreadFile (fileLocation: string) =\u003e Promise\u003cstring\u003e\n```\nPromisified version of fs readFile.\n\n```javascript\nwriteFile (newFileLocation: string, contents:any) =\u003e Promise\u003cvoid\u003e\n```\nPromisified version of fs writeFile.\n\n```javascript\ncopyFile (from: string, to: string) =\u003e Promise\u003cvoid\u003e\n```\nPromisified version of fs copyFile.\n\n```javascript\nmakeDir (location: string) =\u003e Promise\u003cvoid\u003e\n```\nPromisified version of fs makeDir.\n\n```javascript\ndeleteFile (location: string) =\u003e Promise\u003cvoid\u003e\n```\nDeletes the specified file.\n\n```javascript\nrenameFile (fileLocation: string, newFileName: string) =\u003e Promise\u003cvoid\u003e\n```\nRenames the specified file\n\n```javascript\nisPath (stringToCheck: string) =\u003e boolean\n```\nChecks if the given string is a valid path. You can check all covered cases [here](https://github.com/SvetozarMateev/fs-assistant/blob/master/test/integration/isPath.spec.ts).\n\n```javascript\nflattenDir (dirLocation: string, newLocation: string) =\u003e Promise\u003cvoid\u003e\n```\nMoves all files from a directory (recursively) to a new directory.\nFor example if you have the directory `./myFiles` with a file `./myFiles/myFile.txt` and a nested directory `./myFiles/nestedFiles` which contains `./myFiles/nestedFiles/nestedFile.txt` the flattenDir function will move both files to the same level in a new output directory.\n\n```javascript\ngetFilesInDir(dirLocation: string) =\u003e Promise\u003cFileDetails[]\u003e\n```\nReturns an array with all file names and locations in a directory (recursively). Note that the location property in FileDetails represents the path + the name of the file.\n\n```javascript\nreadDir(dir: string) =\u003e Promise\u003cstring[]\u003e\n```\nThe promisified version of fs.readdir.\n\n```javascript\ngetDirsInDir(dirLocation: string) =\u003e Promise\u003cFileDetails[]\u003e\n```\nReturns an array with all sub directories of a directory.\n\n```javascript\ngetFilesInDir(dirLocation: string) =\u003e Promise\u003cDirectoryDetails[]\u003e\n```\nReturns an array with all items represented either as FileDetails or as DirectoryDetails.\n\n```javascript\ngetFileSizeInBytes: (location: string) =\u003e Promise\u003cnumber\u003e;\n```\nReturns the file size in bytes.\n\n```javascript\ngetDirSizeInBytes: (location: string) =\u003e Promise\u003cnumber\u003e;\n```\nReturns the directory size in bytes.\n\n```javascript\ndelDir: (location: string) =\u003e Promise\u003cvoid\u003e;\n```\nDeletes the directory recursively.\n\n```javascript\nexistsSync: (location: string) =\u003e boolean;\n```\nEquivalent to `fs.existsSync()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvetozarmateev%2Ffs-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvetozarmateev%2Ffs-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvetozarmateev%2Ffs-assistant/lists"}