{"id":18657784,"url":"https://github.com/lightsofapollo/traverse-directory","last_synced_at":"2025-08-02T00:03:20.898Z","repository":{"id":57379325,"uuid":"11913662","full_name":"lightsofapollo/traverse-directory","owner":"lightsofapollo","description":"Clone directory with various options on how to copy/symlink files and directories.","archived":false,"fork":false,"pushed_at":"2014-05-10T00:13:54.000Z","size":239,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-24T17:08:13.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightsofapollo.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","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":"2013-08-06T02:08:06.000Z","updated_at":"2015-11-23T20:10:24.000Z","dependencies_parsed_at":"2022-09-02T21:21:55.880Z","dependency_job_id":null,"html_url":"https://github.com/lightsofapollo/traverse-directory","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lightsofapollo/traverse-directory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Ftraverse-directory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Ftraverse-directory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Ftraverse-directory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Ftraverse-directory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightsofapollo","download_url":"https://codeload.github.com/lightsofapollo/traverse-directory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Ftraverse-directory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268315816,"owners_count":24231056,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-07T07:29:52.219Z","updated_at":"2025-08-02T00:03:20.852Z","avatar_url":"https://github.com/lightsofapollo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"traverse-directory\n===============\n\n[![Build\nStatus](https://travis-ci.org/lightsofapollo/traverse-directory.png)](https://travis-ci.org/lightsofapollo/traverse-directory)\n\nTraverse directories with various ways of reading/copying/symlink directories.\nThe intent is primarily cases where you want to do complex cloning of one directory into another.\n\n## Usage\n\nTraverse directory is an async queue. Each operation is added to the\nqueue (but operations run in parallel) and when no more operations are\nleft on the queue the traverse directory is complete.\n\n\n```js\nvar TraverseDirectory = require('traverse-directory');\n\nvar traverse = new TraverseDirectory(\n  '/path/to/source', /* source directory */\n  '/path/to/dest' /* path to target */\n);\n\n// the target directory will be created if it does not exist already.\n\n/**\nHandle directories starting with the source\n\n@param {String} source directory.\n@param {String} target directory (this does not exist yet).\n@param {Function} next see usage below.\n*/\ntraverse.directory(function(source, target, next) {\n  /**\n  the \"next\" argument is a function which expects three arguments\n  which handle how the source / target are handled.\n\n  You must call next() to indicate that the item has been handled.\n  If you have no action to take, just call next() with no arguments.\n\n  @param {Function} action (see below) to handle source/target.\n  @param {String} source path.\n  @param {String} target path.\n  */\n  next(TraverseDirectory.copydir, source, target);\n});\n\n/**\nHandle file found in a directory. Unlike the directory\ncommand file is optional (though generally needed).\n\n@param {String} source directory.\n@param {String} target directory (this does not exist yet).\n@param {Function} next see usage below.\n*/\ntraverse.file(function(source, target, next) {\n  // see directory\n});\n\ntraverse.run(function(err) {\n  // traversal is complete\n});\n\n// after run is called event listeners can be added in addition.\ntraverse.on('error', ...);\ntraverse.on('complete', ...);\n```\n\n## Actions\n\nThe \"next\" argument above takes an action as the first argument.\n\n```js\nTraverseDirectory = require('traverse-directory');\n// ...\n\n// somewhere in the directory or file methods.\nnext(TraverseDirectory[ACTION_NAME], source, target);\n\n// If you are doing something inline that doesn't need handing\n// off to an action, just call without arguments\nnext();\n```\n\nFor examples on how to write actions see index.js.\n\n## For files:\n\n### TraverseDirectory.copyfile\ncopies the contents of a file\n\n### TraverseDirectory.symlinkfile\nsymlinks file from source to dest\n\n## For directories:\n\n### TraverseDirectory.readdir\nreads all files in directory (triggers the call to traverse.file)\n\n### TraverseDirectory.copydir\nCalls readdir and creates a directory in the target path.\nThis action does _not_ affect files.\n\n### TraverseDirectory.symlinkdir\nSymlinks target directory to source directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Ftraverse-directory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightsofapollo%2Ftraverse-directory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Ftraverse-directory/lists"}