diff --git a/README.md b/README.md index b4639f0..e63510d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,16 @@ -# fs -Cross Runtime (Deno, Node, Bun) filesystem operations for JavaScript and TypeScript +# @cross/fs + +Available for Node, Deno Bun and Browser at [jsr.io/@cross/fs](https://jsr.io/@cross/fs). + +**Work in progress** Cross Runtime filesystem operations for JavaScript and TypeScript. + +For cross rutime path operations, [jsr.io/@std/path](https://jsr.io/@std/path) will cover most scenarios, this library focuses on the file system operations. + +## Coverage + +| Method | Deno | Node | Bun | Browser (LocalStorage) | +|--------|------|------|-----|-------- | +| access | X | X | X | | +| readfile | X | X | X | | +| writefile | X | X | X | | +| ... | | | | | \ No newline at end of file diff --git a/access/mod.ts b/access/mod.ts new file mode 100644 index 0000000..bcb5f0b --- /dev/null +++ b/access/mod.ts @@ -0,0 +1,18 @@ +import { CurrentRuntime, Runtime } from "@cross/runtime"; + +// Defailt to failure +// deno-lint-ignore prefer-const +let access = () => { throw new Error("Unsupported Runtime") }; + +switch (CurrentRuntime) { + case Runtime.Node: + break; + case Runtime.Deno: + break; + case Runtime.Bun: + break; + case Runtime.Browser: + break; +} + +export { access }; \ No newline at end of file diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..741ac87 --- /dev/null +++ b/deno.json @@ -0,0 +1 @@ +{ "imports": { "@cross/runtime": "jsr:@cross/runtime@^0.0.16" } } diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..f30ea86 --- /dev/null +++ b/deno.lock @@ -0,0 +1,19 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@cross/runtime@^0.0.16": "jsr:@cross/runtime@0.0.16" + }, + "jsr": { + "@cross/runtime@0.0.16": { + "integrity": "91fdccc7048f168b914e37caf06df3416a3bb36cc330ef22b7bd73ac95ff8de0" + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@cross/runtime@^0.0.16" + ] + } +} diff --git a/mod.ts b/mod.ts new file mode 100644 index 0000000..34e0ad4 --- /dev/null +++ b/mod.ts @@ -0,0 +1 @@ +export { access } from "./access/mod.ts"; \ No newline at end of file