{"id":23286681,"url":"https://github.com/allnulled/universal-file-system","last_synced_at":"2025-04-06T15:33:58.165Z","repository":{"id":268231641,"uuid":"903711993","full_name":"allnulled/universal-file-system","owner":"allnulled","description":"Universal File System to work with files in browser and node.js under the same API.","archived":false,"fork":false,"pushed_at":"2025-02-05T11:26:13.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T05:32:57.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@allnulled/universal-file-system","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/allnulled.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-15T11:14:17.000Z","updated_at":"2025-02-05T11:27:45.000Z","dependencies_parsed_at":"2024-12-15T12:21:27.030Z","dependency_job_id":"d14bd1b7-055a-47c8-ab8c-63c629d905cf","html_url":"https://github.com/allnulled/universal-file-system","commit_stats":null,"previous_names":["allnulled/universal-file-system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Funiversal-file-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Funiversal-file-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Funiversal-file-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Funiversal-file-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allnulled","download_url":"https://codeload.github.com/allnulled/universal-file-system/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247503540,"owners_count":20949457,"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":[],"created_at":"2024-12-20T02:14:03.361Z","updated_at":"2025-04-06T15:33:58.121Z","avatar_url":"https://github.com/allnulled.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# universal-file-system\n\nSistema de ficheros universal, para node.js y browser.\n\nNo tiene dependencias y funciona igual en browser como en node.js.\n\n## Instalación\n\n```sh\nnpm install @allnulled/universal-file-system\n```\n\n## API\n\nUsa localStorage o IDB en browser y fs en node.js.\n\nLos métodos son síncronos, y son estos:\n\n- `resolve_path(...args)`: devuelve la tura completa al nodo fs. Como `path.resolve`.\n- `get_current_directory()`: devuelve el directorio actual.\n- `make_directory(dir)`: crea un directorio.\n- `change_directory(dir)`: mueve el directorio actual.\n- `write_file(file, content)`: (sobre)escribe un nuevo fichero.\n- `read_directory(dir)`: lista los nodos del directorio.\n- `read_file(file)`: lee el contenido del fichero.\n- `delete_file(file)`: elimina el directorio.\n- `delete_directory(dir)`: elimina el fichero.\n- `exists(node)`: devuelve si existe o no.\n- `is_file(node)`: devuelve si es fichero o no.\n- `is_directory(node)`: devuelve si es directorio o no.\n- `rename(name, newName)`: le cambia el nombre a un fichero o directorio.\n\n## Uso\n\nPara empezar a usarlo bien, deberías especificar el driver que quieres usar, y las opciones son estas:\n\n```js\nconst nodeFs = UFS_manager.driver(\"node\").create();\nconst localStorageFs = UFS_manager.driver(\"localStorage\").create(dbId);\nconst idbFs = UFS_manager.driver(\"idb\").create(dbId);\n```\n\nLuego ya puedes usar la API que sea de la misma forma, con las salvedades que tenga, como llamadas asíncronas, o API interna, pero los contratos de los métodos son prácticamente iguales.\n\n## Test\n\nPuedes ver los tests dentro.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Funiversal-file-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallnulled%2Funiversal-file-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Funiversal-file-system/lists"}