{"id":21531901,"url":"https://github.com/matrixai/js-virtualfs","last_synced_at":"2025-04-10T00:29:04.732Z","repository":{"id":48644532,"uuid":"93867780","full_name":"MatrixAI/js-virtualfs","owner":"MatrixAI","description":"In-memory filesystem written in JavaScript for Node.js and Browsers","archived":false,"fork":false,"pushed_at":"2021-09-20T05:56:59.000Z","size":1872,"stargazers_count":27,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-14T21:32:24.641Z","etag":null,"topics":["filesystem","filesystem-library","in-memory-fs","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatrixAI.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":"2017-06-09T14:38:05.000Z","updated_at":"2024-06-13T10:00:23.000Z","dependencies_parsed_at":"2022-08-30T02:03:09.946Z","dependency_job_id":null,"html_url":"https://github.com/MatrixAI/js-virtualfs","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixAI%2Fjs-virtualfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixAI%2Fjs-virtualfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixAI%2Fjs-virtualfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatrixAI%2Fjs-virtualfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatrixAI","download_url":"https://codeload.github.com/MatrixAI/js-virtualfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226116112,"owners_count":17575948,"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":["filesystem","filesystem-library","in-memory-fs","javascript","nodejs"],"created_at":"2024-11-24T02:18:05.388Z","updated_at":"2024-11-24T02:18:09.668Z","avatar_url":"https://github.com/MatrixAI.png","language":"JavaScript","readme":"# VirtualFS\n\nVirtualFS is a virtual posix-like filesystem that runs completely in memory. It is intended to work in browsers and in NodeJS. For browser usage, make use of a bundler like Webpack, Browserify or Rollup.\n\nIt includes:\n\n* Proper stat metadata with MAC time handling\n* Symlink support\n* Hardlink support\n* Virtual inodes\n* File descriptor support\n* Proper streams implementation\n* Character device support (/dev/null, /dev/full, /dev/tty...)\n* Current working directory support\n* Simulation of Unix file permissions\n* Umask is considered when creating new iNodes\n* Simulates POSIX filesystem errors\n* Emulates `mmap` with `MAP_PRIVATE` and `MAP_SHARED`\n* Usage of Flow types\n* Removal of all Windows path support\n* Practically complete compatibility with Node's FileSystem API\n\nThis package will be maintained as long as the Polykey project is maintained. All tests are passing in this fork.\n\nDocumentation\n--------------\n\nDocumentation is located in the `doc` folder. You can also view the [rendered HTML](https://cdn.rawgit.com/MatrixAI/js-virtualfs/64b3d7de/doc/index.html).\n\nThe VirtualFS API extends Node's `fs` API, while also leaving out functions that are not emulatable in-memory. For the functions that have the same name, you can just refer to Node's FS API: https://nodejs.org/api/fs.html. For the functions that don't have the name, refer to the generated API documentation that uses flow types. The source code is understandable so you can just read that as well.\n\nTo use VirtualFS as a global polyfill for `fs`, all you need to do is:\n\n```js\nimport vfs from 'virtualfs';\n(typeof self === 'undefined' ? typeof global === 'undefined' ? this : global : self).fs = vfs;\n// alternatively use the global package `import global from 'global'; global.fs = vfs;`\n```\n\nAll subsequent uses of `fs` in the current module, subsequently imported modules, and __any module that imports the current module__ will also use the same `fs`. The above monkeypatch works in Node, Browsers and Web Workers. However this will also make `/dev/tty` not work because it uses Node's real `fs`. Instead you should rely on a per-module override. Unless of course you're not using `/dev/tty` in Node.\n\nIn order to only override on a per-module basis you'll need to use the rewire package or the https://github.com/speedskater/babel-plugin-rewire babel plugin.\n\nWhen using this in a CommonJS environment, you can gain access to the default `fs` replacement by using `var fs = require('virtualfs').default;`.\n\nDevelopment\n-------------\n\nTo run flow type checks:\n\n```\nflow status\nflow stop\n```\n\nTo build this package for release:\n\n```\nnpm run build\n```\n\nIt will run tests, generate documentation and output multiple targets. One for browsers and one for nodejs. See `rollup.config.js` to see the target specification.\n\nIf your bundler is aware of the module field in `package.json`, you'll get the ES6 module directly.\n\nOnce you've updated the package run this:\n\n```\nnpm version \u003cupdate_type\u003e\nnpm publish\n```\n\nThe browser target makes use of these polyfills:\n\n* buffer - Used everywhere.\n* events - Used by streams dependency.\n* path - Used for `join`.\n* process - Used for `nextTick` and `stdin` and `stdout` streams.\n* stream - Used for filesystem streaming\n\nThey are currently supplied through Rollup plugins.\n\nTodo\n-----\n\n* Investigate mounting implementation\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrixai%2Fjs-virtualfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatrixai%2Fjs-virtualfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrixai%2Fjs-virtualfs/lists"}