{"id":19217991,"url":"https://github.com/sallar/dropbox-fs","last_synced_at":"2025-08-17T11:07:10.471Z","repository":{"id":12254606,"uuid":"71348843","full_name":"sallar/dropbox-fs","owner":"sallar","description":":package: Node FS wrapper for Dropbox","archived":false,"fork":false,"pushed_at":"2021-11-25T12:48:25.000Z","size":254,"stargazers_count":36,"open_issues_count":6,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T04:55:58.066Z","etag":null,"topics":["dropbox","filesystem","fs","node","node-js"],"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/sallar.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-10-19T11:08:36.000Z","updated_at":"2025-03-23T08:48:15.000Z","dependencies_parsed_at":"2022-08-07T06:16:51.099Z","dependency_job_id":null,"html_url":"https://github.com/sallar/dropbox-fs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sallar/dropbox-fs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sallar%2Fdropbox-fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sallar%2Fdropbox-fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sallar%2Fdropbox-fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sallar%2Fdropbox-fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sallar","download_url":"https://codeload.github.com/sallar/dropbox-fs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sallar%2Fdropbox-fs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837583,"owners_count":24654391,"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-17T02:00:09.016Z","response_time":129,"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":["dropbox","filesystem","fs","node","node-js"],"created_at":"2024-11-09T14:24:49.500Z","updated_at":"2025-08-17T11:07:10.434Z","avatar_url":"https://github.com/sallar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dropbox-fs [![Build Status](https://travis-ci.org/sallar/dropbox-fs.svg?branch=master)](https://travis-ci.org/sallar/dropbox-fs) [![codecov](https://codecov.io/gh/sallar/dropbox-fs/branch/master/graph/badge.svg)](https://codecov.io/gh/sallar/dropbox-fs) [![npm version](https://badge.fury.io/js/dropbox-fs.svg)](https://www.npmjs.com/package/dropbox-fs)\n\nNode [`fs`](https://nodejs.org/api/fs.html) wrapper for Dropbox. Wraps the [Dropbox](http://npmjs.com/package/dropbox) javascript module with an async `fs`-like API so it can be used where a fileSystem API is expected.\n\n\n## Installation\n\nTo use this module you'll need a [Dropbox Access Token](https://blogs.dropbox.com/developers/2014/05/generate-an-access-token-for-your-own-account/).\n\n``` bash\n$ npm install --save dropbox-fs\n```\n\n## Usage\n\n``` js\nconst dfs = require('dropbox-fs')({\n    apiKey: 'DROPBOX_API_KEY_HERE'\n});\n\ndfs.readdir('/Public', (err, result) =\u003e {\n    console.log(result); // Array of files and folders\n});\n```\n\nPromises are also supported.\n\n```js\nconst dfs = require('dropbox-fs/promises')({\n    apiKey: 'DROPBOX_API_KEY_HERE'\n});\n```\n\nYou can also pass in a `client` option if you’re using your own `dropbox` module instead of the `apiKey`.\n\nIf you'd like some peace of mind then there's a read-only option too:\n\n``` js\nconst dfs = require('dropbox-fs/readonly')({\n    apiKey: 'DROPBOX_API_KEY_HERE'\n});\n\n// Methods that might change data now return an error without performing any action:\n// - mkdir\n// - rename\n// - rmdir\n// - unlink\n// - writeFile\n\ndfs.unlink('/Public', (err) =\u003e {\n    console.log(err); // Message saying `unlink` is not supported in read-only\n});\n```\n\n## API\n\nThis module exposes the following methods:\n\n### readdir(path[, options], callback)\n\nReads a directory and returns a list of files and folders inside.\n\n``` js\ndfs.readdir('/', (err, result) =\u003e {\n    console.log(result);\n});\n```\n\n- `path`: `String|Buffer`\n- `callback`: `Function`\n\n### mkdir(path, callback)\n\nCreates a directory.\n\n``` js\ndfs.mkdir('/Public/Resume', (err, stat) =\u003e {\n    console.log(stat.name); // Resume\n    console.log(stat.isDirectory()); // true\n});\n```\n\n- `path`: `String|Buffer`\n- `callback`: `Function`\n\n### rmdir(path, callback)\n\nDeletes a directory.\n\n``` js\ndfs.rmdir('/Public/Resume', err =\u003e {\n    if (!err) {\n        console.log('Deleted.');\n    }\n});\n```\n\n- `path`: `String|Buffer`\n- `callback`: `Function`\n\n### readFile(path[, options], callback)\n\nReads a file and returns it’s contents.\n\n``` js\n// Buffer:\ndfs.readFile('/Work/doc.txt', (err, result) =\u003e {\n    console.log(result.toString('utf8'));\n});\n\n// String\ndfs.readFile('/Work/doc.txt', {encoding: 'utf8'}, (err, result) =\u003e {\n    console.log(result);\n});\n```\n\n- `path`: `String|Buffer`\n- `options`: Optional `String|Object`\n    - `encoding`: `String`\n- `callback`: `Function`\n\nIf you pass a string as the `options` parameter, it will be used as `options.encoding`. If you don’t provide an encoding, a raw `Buffer` will be passed to the callback.\n\n### writeFile(path, data[, options], callback)\n\nWrites a file to the remote API and returns it’s `stat`.\n\n``` js\nconst content = fs.readFileSync('./localfile.md');\ndfs.writeFile('/Public/doc.md', content, {encoding: 'utf8'}, (err, stat) =\u003e {\n    console.log(stat.name); // doc.md\n});\n```\n\n- `path`: `String|Buffer`\n- `data`: `String|Buffer`\n- `options`: Optional `String|Object`\n    - `encoding`: `String`\n    - `overwrite`: `Boolean` Default: `true`.\n- `callback`: `Function`\n\n### rename(fromPath, toPath, callback)\n\nRenames a file (moves it to a new location).\n\n``` js\ndfs.rename('/Public/doc.md', '/Backups/doc-backup.md', err =\u003e {\n    if err {\n        console.error('Failed!');\n    } else {\n        console.log('Moved!');\n    }\n});\n```\n\n- `path`: `String|Buffer`\n- `data`: `String|Buffer`\n- `callback`: `Function`\n\n### stat(path, callback)\n\nReturns the file/folder information.\n\n``` js\ndfs.stat('/Some/Remote/Folder/', (err, stat) =\u003e {\n    console.log(stat.isDirectory()); // true\n    console.log(stat.name); // Folder\n});\n```\n\n- `path`: `String|Buffer`\n- `callback`: `Function`\n    - `err`: `null|Error`\n    - `stat`: [Stat](#stat-object) Object\n\n### unlink(path, callback)\n\nDeletes a file.\n\n``` js\ndfs.unlink('/Path/To/file.txt', err =\u003e {\n    if (!err) {\n        console.log('Deleted!');\n    }\n});\n```\n\n- `path`: `String|Buffer`\n- `callback`: `Function`\n\n## createReadStream(path)\n\nCreates a readable stream.\n\n``` js\nconst stream = fs.createReadStream('/test/test1.txt');\nstream.on('data', data =\u003e {\n    console.log('data', data);\n});\nstream.on('end', () =\u003e {\n    console.log('stream finished');\n});\n```\n- `path`: `String|Buffer`\n\n## createWriteStream(path)\n\nCreates a writable stream.\n\n``` js\nconst stream = fs.createWriteStream('/test/test1.txt');\n\nsomeStream().pipe(stream).on('finish', () =\u003e {\n    console.log('write stream finished');\n});\n```\n\n- `path`: `String|Buffer`\n\n## Stat Object\n\nThe stat object that is returned from `writeFile()` and `stat()` contains two methods in addition to some standard information like `name`, etc:\n\n- `stat.isDirectory()` Returns `true` if the target is a directory\n- `stat.isFile()` Returns `true` if the target is a file\n\n## License\n\nThis software is released under the [MIT License](https://sallar.mit-license.org/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsallar%2Fdropbox-fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsallar%2Fdropbox-fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsallar%2Fdropbox-fs/lists"}