From 03c300c1e6a25d988bc1b351196787cbf281569f Mon Sep 17 00:00:00 2001 From: Hexagon Date: Thu, 7 Mar 2024 13:16:59 +0000 Subject: [PATCH] Skeleton --- README.md | 18 ++++++++++++++++-- access/mod.ts | 18 ++++++++++++++++++ deno.json | 1 + deno.lock | 19 +++++++++++++++++++ mod.ts | 1 + 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 access/mod.ts create mode 100644 deno.json create mode 100644 deno.lock create mode 100644 mod.ts 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