{"id":13658809,"url":"https://github.com/anyfs/anyfs","last_synced_at":"2025-06-11T09:32:38.613Z","repository":{"id":21029330,"uuid":"24325143","full_name":"anyfs/anyfs","owner":"anyfs","description":"Portable file system for Node","archived":false,"fork":false,"pushed_at":"2015-04-27T02:45:07.000Z","size":253,"stargazers_count":22,"open_issues_count":6,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T08:44:01.637Z","etag":null,"topics":["aws-s3","dropbox","filesystem","ftp","gulp","gulp-plugin","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/anyfs.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":"2014-09-22T10:59:32.000Z","updated_at":"2024-05-30T03:55:15.000Z","dependencies_parsed_at":"2022-09-06T00:21:16.591Z","dependency_job_id":null,"html_url":"https://github.com/anyfs/anyfs","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/anyfs%2Fanyfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anyfs%2Fanyfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anyfs%2Fanyfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anyfs%2Fanyfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anyfs","download_url":"https://codeload.github.com/anyfs/anyfs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anyfs%2Fanyfs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259239017,"owners_count":22826844,"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":["aws-s3","dropbox","filesystem","ftp","gulp","gulp-plugin","nodejs"],"created_at":"2024-08-02T05:01:02.807Z","updated_at":"2025-06-11T09:32:38.579Z","avatar_url":"https://github.com/anyfs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# anyfs\n\n[![npm](https://img.shields.io/npm/v/anyfs.svg?style=flat-square)](https://www.npmjs.com/package/anyfs)\n[![npm](https://img.shields.io/npm/dm/anyfs.svg?style=flat-square)](https://www.npmjs.com/package/anyfs)\n[![Travis](https://img.shields.io/travis/anyfs/anyfs.svg?style=flat-square)](https://travis-ci.org/anyfs/anyfs)\n![npm](https://img.shields.io/npm/l/anyfs.svg?style=flat-square)\n\nAnyFS is a portable filesystem abstraction for Node. It aims to provide a \nconsistent API for different file systems. \n\nWARNING: AnyFS is under heavy development, things may change at any time!\na\n## Features\n\n- Extensible with plugins\n- Super portable with file system adapters\n- Works well with Gulp (vinyl-fs plugin)\n- API with Promise support\n\n## Adapters\n\nAnyFS comes with following adapters.\n\n- [Dropbox](https://github.com/anyfs/dropbox-adapter) - NPM: anyfs-dropbox-adapter\n- [FTP](https://github.com/anyfs/ftp-adapter) - NPM: anyfs-ftp-adapter\n- [AWS S3](https://github.com/anyfs/s3-adapter) - NPM: anyfs-s3-adapter\n- Memory - Builtin, access with `AnyFS.MemoryAdapter`\n- \u003cdel\u003e[Local](https://github.com/anyfs/local-adapter): local file system\u003c/del\u003e\n- \u003cdel\u003eSFTP\u003c/del\u003e\n- \u003cdel\u003eBaidu\u003c/del\u003e\n- \u003cdel\u003eGIT\u003c/del\u003e\n- \u003cdel\u003eSVN\u003c/del\u003e\n\n## Plugins\n\n- Core: builtin, basic filesystem support.\n- [glob](https://github.com/anyfs/glob-plugin): match files easily.\n- [vinyl-fs](https://github.com/anyfs/vinyl-fs-plugin): vinyl-fs port, works well with gulp\n\n## Usage\n\n```js\nvar AnyFs = require('anyfs');\nvar FtpAdapter = require('anyfs-ftp-adapter');\nvar DropboxAdapter = require('anyfs-dropbox-adapter');\nvar VinylFsPlugin = require('anyfs-vinyl-fs-plugin');\nAnyFS.addPlugin(new VinylFsPlugin());\n\nvar fs1 = new AnyFS(new FtpAdapter({\n    server: 'ftp.example.com',\n    username: 'user',\n    password: 'password',\n}));\n\nvar fs2 = new AnyFS(new DropboxAdapter({\n    key: 'appkey',\n    secret: 'appsecret',\n    token: 'token',\n}));\n\n// Copy files across filesystems(requires the vinyl-fs plugin)\nfs1.src('/**/*.jpg')\n    .pipe(fs2.dest('/backup/abc/'));\n\n// Promise style API\nfs1.mkdir('/doc')\n    .then(function() {\n        return this.writeFile('/doc/index.md', \"content\");\n    })\n    .then(function() {\n        return this.metadata('/doc/index.md');\n    })\n    .done(function(metadata) {\n        console.log(metadata.size);\n    }, function(err) {\n        console.log('Error occured: ', err);\n    });\n\n// callback API\nfs.mkdir('/doc', function(err) {\n    if (err) {\n        console.log(err);\n    } else {\n        console.log('mkdir ok');\n    }\n});\n```\n\n## API\n\n### Core API\n\nFollowing APIs are basic file system APIs.\n\n#### `constructor(adapter, options)`\n\nThe constructor accepts an adapter and an options object.\n\nCommon options: \n\n- cwd: Current working directory.\n\n#### `metadata(path[, callback(error, metadata)])`\n\nRetrieves file and folder metadata.\n\nFolder metadata:\n\n```js\n{\n    \"name\": \"dir1\",\n    \"time\": [Date Object],\n    \"is_dir\": true,\n}\n```\n\nFile metadata:\n\n```js\n{\n    \"name\": \"file1.txt\",\n    \"time\": [Date Object],\n    \"is_dir\": false,\n    \"size\": 123,\n    ...\n}\n```\n\nIf callback is not provided, a promise is returned.\n\n#### `list(path[, callback(error, list)])`\n\nGet contents of directory.\n\n```\n[\n    {\n        // metadata\n    },\n    ...\n]\n```\n\n#### `mkdir(path[, callback(error)])`\n\nCreate directory recursively.\n\nIf callback is not provided, a promise is returned.\n\n#### `delete(path[, callback(error)])`\n\nDelete file.\n\nIf callback is not provided, a promise is returned.\n\n#### `deleteDir(path[, callback(error)])`\n\nDelete directory recursively.\n\nIf callback is not provided, a promise is returned.\n\n#### `move(oldPath, newPath[, callback(error)])`\n\nMove file or directory to a new place.\n\nParent folder of `newPath` is created automaticly.\n\nIf callback is not provided, a promise is returned.\n\n#### `writeFile(path, content[, options][, callback(error)])`\n\nWrite file content, will try to create parent directory.\n\nIf callback is not provided, a promise is returned.\n\n#### `readFile(path[, options][, callback(error, data)])`\n\nRead file content.\n\nIf callback is not provided, a promise is returned.\n\n#### `createWriteStream(path[, options])`\n\nCreate write stream.\n\n#### `createReadStream(path[, options])`\n\nCreate read stream.\n\n### Extra API\n\nExtra APIs are supported by plugins\n\n## Create Custom Adapters\n\nSee [adapter specification](adapter.md)\n\n## Create Plugins\n\n## Acknowledgement\n\nLogo by [denjello](https://github.com/denjello)\n\nInspired by [Flysystem](http://flysystem.thephpleague.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanyfs%2Fanyfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanyfs%2Fanyfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanyfs%2Fanyfs/lists"}