{"id":19839483,"url":"https://github.com/xeaone/fsep","last_synced_at":"2026-05-16T05:03:22.259Z","repository":{"id":57242451,"uuid":"64687278","full_name":"xeaone/fsep","owner":"xeaone","description":"FSEP = Fs + Extras + Promises","archived":false,"fork":false,"pushed_at":"2018-03-31T20:42:51.000Z","size":64,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T01:34:41.438Z","etag":null,"topics":["fs-extra","js","mkdir","node","nodejs","outputfile","promise","readfile","scaffold"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xeaone.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}},"created_at":"2016-08-01T17:26:15.000Z","updated_at":"2018-03-31T20:42:52.000Z","dependencies_parsed_at":"2022-09-09T02:33:49.327Z","dependency_job_id":null,"html_url":"https://github.com/xeaone/fsep","commit_stats":null,"previous_names":["alexanderelias/fsep"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Ffsep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Ffsep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Ffsep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Ffsep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xeaone","download_url":"https://codeload.github.com/xeaone/fsep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241209543,"owners_count":19927735,"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-extra","js","mkdir","node","nodejs","outputfile","promise","readfile","scaffold"],"created_at":"2024-11-12T12:22:46.412Z","updated_at":"2026-05-16T05:03:22.164Z","avatar_url":"https://github.com/xeaone.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# FSEP\nIs a library that promisifies the native node FS operation and brings extras into the mix. Fsep has **No Dependency**.\n\n## Features\n- Native node.js Fs methods (promisified)\n- Only Promises\n\n## TODO\n- copy\n- ensureLink\n- move\n- outputJson\n- readJson\n- remove\n- writeJson\n\n\n## API\n- walk\n- exist\n\n- mkdirs\n\n- emptyFolder\n\n- outputFile\n- outputFolder\n\n- ensureFile\n- ensureFolder\n- ensureSymlink\n\n- scaffold\n- readFiles\n- readWriteLine\n\n- readFolder\n- removeFile\n- removeFolder\n- writeFolder\n\n\n### walk(path, [options])\n- `options: Object`\n\t- `path: String` Path to directory\n\t- `filters: Array` RegExp strings\n\t- `relative: Boolean` Return paths relative or absolute. Default is `false`\n\t- `ignoreDot: Boolean` Ignores files beginning with a dot. Default is `true`\n\n```js\nconst Fsep = require('fsep');\nconst path = '/home/user/directory';\nconst options = {\n\trelative: false,\n\tignoreDot: true,\n\tfilters: ['.DS_Store']\n};\n\nFsep.walk(path, options).then(function (files) {\n\tconsole.log(files);\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### exist(path)\nChecks if a path exists. Returns `true` or `false`. Uses `Fs.stat`.\n\n```js\nconst Fsep = require('fsep');\n\nFsep.exist(path).then(function (exist) {\n\tconsole.log(exist); // true || false\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### mkdirs(path [,mode])\nCreates the path folders if they do not exist. Accepts a `mode` parameter.\n\n```js\nconst Fsep = require('fsep');\nconst path = '/non/existing/dir';\n\nFsep.mkdirs(path).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### outputFile(path, data, [options])\nCreates a file and also directories if non existent. Overwrites file if it exists.\n```js\nconst Fsep = require('fsep');\n\nvar path = '/non/existing/path/file.js';\nvar data = 'hello';\n\nFsep.outputFile(path, data).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### outputFolder(path [,mode, cwd])\nCreates folders in path if they do not exist.\n```js\nconst Fsep = require('fsep');\nconst path = '/non/existing/dir';\n\nFsep.outputFolder(path).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### ensureFolder(path, [,mode, cwd])\nCreates folders in path if they do not exist.\n```js\nconst Fsep = require('fsep');\nconst path = '/non/existing/dir';\n\nFsep.ensureFolder(path).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### ensureFile(path, data, [options], [mode || cwd])\nEnsures that the file and its directory structure exists. If the file already exists it is **not modified**.\n```js\nconst Fsep = require('fsep');\n\nvar path = '/non/existing/dirs/and/file.txt';\n\nFsep.ensureFile(path).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### ensureSymlink(source, target, type, [mode || cwd])\nEnsures that the symlink and its directory structure exists. If the file already exists it is **not modified**.\n```js\nconst Fsep = require('fsep');\nconst src = '/existing/folders/file.txt';\nconst dst = '/non/existing/folders/file.txt';\n\nFsep.ensureSymlink(source, target).then(function () {\n\tconsole.log('symlink created');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### emptyFolder(path, safe)\nDeletes the contents of a directory if it exists and is not empty. This is recursive so be careful. Same as `rm -r`.\n- `path: String` Path to the direcotry to empty.\n- `safe: Boolean` Default is true which throws an error if you try to empty the root of the file system.\n```js\nconst Fsep = require('fsep');\n\nvar path = '/home/username/dirs'; // contains folders and files\n\nFsep.emptyFolder(path).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### scaffold(path, data)\nRequires a path and an object or array. Makes files and folders based on object or array. End points are assumed to be file names.\n```js\nconst Fsep = require('fsep');\n\nconst data = {\n\tone: 'one.txt',\n\ttwo: 'two.txt',\n\tarray: [\n\t\t'three.txt',\n\t\t'four.txt'\n\t]\n};\n\nFsep.scaffold(path, data).then(function () {\n\tconsole.log('done');\n\t/* output\n\t\tone\n\t\t\tone.txt\n\t\ttwo\n\t\t\ttwo.txt\n\t\tarray\n\t\t\tthree.txt\n\t\t\tfour.txt\n\t*/\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### readFiles(paths, options)\nReads an array of files asynchronously. The result is an array of files.\n\n```js\nconst Fsep = require('fsep');\n\nvar paths = [\n\t'/one.txt',\n\t'two.txt'\n];\n\nFsep.readFiles(paths).then(function (files) {\n\tconsole.log(files);\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### readWriteLine(options)\nReads and writes a file line by line. The `line` function allows line manipulation.\n\n```js\nconst Fsep = require('fsep');\n\nvar options = {\n\tread: { // node stream options\n\t\tpath: './rw/one.txt'\n\t},\n\twrite: { // node stream options\n\t\tpath: './rw/two.txt',\n\t\tflags: 'a'\n\n\t},\n\tline: function (line) {\n\t\treturn line.toUpperCase();\n\t}\n};\n\nFsep.readWriteLine(options).then(function () {\n\tconsole.log('done');\n}).catch(function (error) {\n\tconsole.error(error);\n});\n```\n\n### readFolder\nAlias for `Fs.readdir`.\n\n### removeFile\nAlias for `Fs.unlink`.\n\n### removeFolder\nAlias for `Fs.rmdir`.\n\n### writeFolder\nAlias for `Fs.mkdir`.\n\n## Authors\n[AlexanderElias](https://github.com/AlexanderElias)\n\n## License\n[Why You Should Choose MPL-2.0](http://veldstra.org/2016/12/09/you-should-choose-mpl2-for-your-opensource-project.html)\nThis project is licensed under the MPL-2.0 License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxeaone%2Ffsep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxeaone%2Ffsep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxeaone%2Ffsep/lists"}