Skip to content

Commit

Permalink
Rebranding
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Mar 22, 2024
1 parent 2d1b033 commit d104a56
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion license.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2023 John Vilk and other BrowserFS contributors.
Copyright (c) 2013-2023 John Vilk and other ZenFS contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@browserfs/dom",
"name": "@zenfs/dom",
"version": "0.1.1",
"description": "DOM backends for BrowserFS",
"description": "DOM backends for ZenFS",
"main": "dist/index.js",
"types": "dist",
"keywords": [
Expand All @@ -10,15 +10,15 @@
"storage"
],
"type": "module",
"homepage": "https://github.com/browser-fs/dom",
"homepage": "https://github.com/zen-fs/dom",
"author": "James P. <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/browser-fs/dom.git"
"url": "git+https://github.com/zen-fs/dom.git"
},
"bugs": {
"url": "https://github.com/browser-fs/dom/issues"
"url": "https://github.com/zen-fs/dom/issues"
},
"engines": {
"node": ">= 18"
Expand All @@ -38,7 +38,7 @@
"format:check": "prettier --check src",
"lint": "tsc -p tsconfig.json --noEmit && eslint src",
"build": "node scripts/build.mjs",
"build:docs": "typedoc --out docs --name 'BrowserFS DOM' src/index.ts",
"build:docs": "typedoc --out docs --name 'ZenFS DOM' src/index.ts",
"prepublishOnly": "npm run build"
},
"devDependencies": {
Expand All @@ -51,6 +51,6 @@
"typescript": "5.2.2"
},
"peerDependencies": {
"@browserfs/core": "^0.4.0"
"@zenfs/core": "^0.4.0"
}
}
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# BrowserFS DOM Backends
# ZenFS DOM Backends

[BrowserFS](https://github.com/browser-fs/core) backends for DOM APIs. DOM APIs are _only_ available natively in browsers.
[ZenFS](https://github.com/zen-fs/core) backends for DOM APIs. DOM APIs are _only_ available natively in browsers.

> [!IMPORTANT]
> Please read the BrowserFS core documentation!
> Please read the ZenFS core documentation!
## Backends

- `Storage`: Stores files in a `Storage` object, like `localStorage` and `sessionStorage`.
- `IndexedDB`: Stores files into an `IndexedDB` object database.
- `FileSystemAccess`: Store files using the [Web File System API](https://developer.mozilla.org/Web/API/File_System_API).

For more information, see the [API documentation](https://browser-fs.github.io/dom).
For more information, see the [API documentation](https://zen-fs.github.io/dom).

## Usage

> [!NOTE]
> The examples are written in ESM. If you are using CJS, you can `require` the package. If running in a browser you can add a script tag to your HTML pointing to the `browser.min.js` and use BrowserFS DOM via the global `BrowserFS_DOM` object.
> The examples are written in ESM. If you are using CJS, you can `require` the package. If running in a browser you can add a script tag to your HTML pointing to the `browser.min.js` and use ZenFS DOM via the global `ZenFS_DOM` object.
```js
import { configure, fs } from '@browserfs/core';
import { Storage } from '@browserfs/dom';
import { configure, fs } from '@zenfs/core';
import { Storage } from '@zenfs/dom';

await configure({ backend: Storage, storage: localStorage });

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const options = parseArgs({
const ctx = await context({
entryPoints: ['src/index.ts'],
target: 'es2020',
globalName: 'BrowserFS_DOM',
globalName: 'ZenFS_DOM',
outfile: 'dist/browser.min.js',
sourcemap: true,
keepNames: true,
Expand Down
12 changes: 6 additions & 6 deletions src/FileSystemAccess.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { basename, dirname, join } from '@browserfs/core/emulation/path.js';
import { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';
import { FileFlag, PreloadFile } from '@browserfs/core/file.js';
import { FileSystem, Async, type FileSystemMetadata } from '@browserfs/core/filesystem.js';
import { Stats, FileType } from '@browserfs/core/stats.js';
import type { Backend } from '@browserfs/core/backends/backend.js';
import { basename, dirname, join } from '@zenfs/core/emulation/path.js';
import { ApiError, ErrorCode } from '@zenfs/core/ApiError.js';
import { FileFlag, PreloadFile } from '@zenfs/core/file.js';
import { FileSystem, Async, type FileSystemMetadata } from '@zenfs/core/filesystem.js';
import { Stats, FileType } from '@zenfs/core/stats.js';
import type { Backend } from '@zenfs/core/backends/backend.js';

declare global {
interface FileSystemDirectoryHandle {
Expand Down
16 changes: 8 additions & 8 deletions src/IndexedDB.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AsyncROTransaction, AsyncRWTransaction, AsyncStore, AsyncStoreFS } from '@browserfs/core/backends/AsyncStore.js';
import { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';
import type { Backend } from '@browserfs/core/backends/backend.js';
import type { Ino } from '@browserfs/core/inode.js';
import { AsyncROTransaction, AsyncRWTransaction, AsyncStore, AsyncStoreFS } from '@zenfs/core/backends/AsyncStore.js';
import { ApiError, ErrorCode } from '@zenfs/core/ApiError.js';
import type { Backend } from '@zenfs/core/backends/backend.js';
import type { Ino } from '@zenfs/core/inode.js';

/**
* Converts a DOMException or a DOMError from an IndexedDB event into a
* standardized BrowserFS API error.
* standardized ZenFS API error.
* @hidden
*/
function convertError(e: { name: string }, message: string = e.toString()): ApiError {
Expand Down Expand Up @@ -217,18 +217,18 @@ export const IndexedDB: Backend = {
if (!(idbFactory instanceof IDBFactory)) {
return false;
}
const req = idbFactory.open('__browserfs_test');
const req = idbFactory.open('__zenfs_test');
if (!req) {
return false;
}
req.onsuccess = () => idbFactory.deleteDatabase('__browserfs_test');
req.onsuccess = () => idbFactory.deleteDatabase('__zenfs_test');
} catch (e) {
return false;
}
return true;
},

create({ cacheSize = 100, storeName = 'browserfs', idbFactory = globalThis.indexedDB }: IndexedDBOptions) {
create({ cacheSize = 100, storeName = 'zenfs', idbFactory = globalThis.indexedDB }: IndexedDBOptions) {
const store = IndexedDBStore.create(storeName, idbFactory);
const fs = new AsyncStoreFS({ cacheSize, store });
return fs;
Expand Down
10 changes: 5 additions & 5 deletions src/Storage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SyncStore, SimpleSyncStore, SimpleSyncRWTransaction, SyncRWTransaction, SyncStoreFS } from '@browserfs/core/backends/SyncStore.js';
import { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';
import { type Backend } from '@browserfs/core/backends/backend.js';
import { decode, encode } from '@browserfs/core/utils.js';
import type { Ino } from '@browserfs/core/inode.js';
import { SyncStore, SimpleSyncStore, SimpleSyncRWTransaction, SyncRWTransaction, SyncStoreFS } from '@zenfs/core/backends/SyncStore.js';
import { ApiError, ErrorCode } from '@zenfs/core/ApiError.js';
import { type Backend } from '@zenfs/core/backends/backend.js';
import { decode, encode } from '@zenfs/core/utils.js';
import type { Ino } from '@zenfs/core/inode.js';

/**
* A synchronous key-value store backed by Storage.
Expand Down

0 comments on commit d104a56

Please sign in to comment.